Skip to content

Commit

Permalink
Some quick delete updates to put peoples minds at rest.
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-dolkens committed Feb 22, 2016
1 parent bc478b2 commit 239b021
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 6 deletions.
6 changes: 6 additions & 0 deletions HoloXPLOR/App_Start/RouteConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public static void RegisterRoutes(RouteCollection routes)
defaults: new { controller = "HoloTable", action = "Inventory" }
);

routes.MapRoute(
name: "HangarDelete",
url: "HoloTable/Delete/{id}",
defaults: new { controller = "HoloTable", action = "Delete" }
);

routes.MapRoute(
name: "HangarRating",
url: "HoloTable/Rating/{id}/{shipid}/{targetship}",
Expand Down
23 changes: 23 additions & 0 deletions HoloXPLOR/Controllers/HoloTableController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Xml = HoloXPLOR.Data.XML;
using System.Threading.Tasks;
using System.Net.Http;
using System.Threading;

namespace HoloXPLOR.Controllers
{
Expand Down Expand Up @@ -116,6 +117,28 @@ public ActionResult Rating(String id, Guid shipID, String targetShip)
}
}

public ActionResult Delete(String id)
{
if (String.Equals("sample", id, StringComparison.InvariantCultureIgnoreCase))
{
return RedirectToAction("NotAllowed");
}

HoloTableController._lockMap[id] = HoloTableController._lockMap.GetValue(id, new Object());

lock (HoloTableController._lockMap[id])
{
String filename = HttpContext.Server.MapPath(String.Format(@"~/App_Data/{0}.xml", id));

if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
}
}

return View();
}

private IEnumerable<Guid> FlattenIDs(DetailModel model, Item item)
{
if (item != null || item.ID != Guid.Empty)
Expand Down
7 changes: 5 additions & 2 deletions HoloXPLOR/HoloXPLOR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,7 @@
<Content Include="App_Data\shipmatrix.json" />
<Content Include="Scripts\holoxplor.rating.js" />
<Content Include="Scripts\jquery.ui.touch-punch-0.2.3.js" />
<None Include="Properties\PublishProfiles\holoxplor-test.azurewebsites.net.pubxml" />
<None Include="Properties\PublishProfiles\holoxplor-ptu.pubxml" />
<None Include="Properties\PublishProfiles\holoxplor.azurewebsites.net.pubxml" />
<Content Include="App_Data\Scripts\Entities\Vehicles\Implementations\Xml\AEGS_Avenger_Stalker.xml" />
<Content Include="App_Data\Scripts\Entities\Vehicles\Implementations\Xml\AEGS_Gladius.xml">
Expand Down Expand Up @@ -2312,7 +2312,10 @@
<Content Include="Views\Shared\_GettingStarted.cshtml" />
<Content Include="Views\Shared\_Modal.Upload.cshtml" />
<Content Include="Views\Shared\_Modal.Download.cshtml" />
<Content Include="smtp.config" />
<Content Include="smtp.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Views\HoloTable\Delete.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\media\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://holoxplor-test.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<SiteUrlToLaunchAfterPublish>http://holoxplor-ptu.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>holoxplor-test.scm.azurewebsites.net:443</MSDeployServiceURL>
<DeployIisAppPath>holoxplor-test</DeployIisAppPath>
<MSDeployServiceURL>holoxplor-ptu.scm.azurewebsites.net:443</MSDeployServiceURL>
<DeployIisAppPath>holoxplor-ptu</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$holoxplor-test</UserName>
<UserName>$holoxplor-ptu</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
</PropertyGroup>
Expand Down
17 changes: 17 additions & 0 deletions HoloXPLOR/Views/HoloTable/Delete.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@{
ViewBag.Title = "Hangar";
}

@using (Html.BeginForm("Upload", "HoloTable", FormMethod.Post, new { id = "form-upload" }))
{ }

<hgroup>
<h1>Your Hangar has been removed.</h1>
<h2>You must re-upload your Inventory XML to continue.</h2>
</hgroup>

<div class="row cig-content">
@Html.Partial("_GettingStarted")
@Html.Partial("_Instructions")
@Html.Partial("_Support")
</div>
4 changes: 4 additions & 0 deletions HoloXPLOR/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
<li><a href="@Url.Action("Hangar", "HoloTable", new { id = ViewBag.ID })"><span class="glyphicon glyphicon-globe"></span> Hangar</a></li>
}
<li><a href="@Url.Action("Download", "HoloTable", new { id = ViewBag.ID })" class="js-download"><span class="glyphicon glyphicon-cloud-download"></span> Download</a></li>
@if (!String.Equals(ViewBag.ID, "sample", StringComparison.InvariantCultureIgnoreCase))
{
<li><a href="@Url.Action("Delete", "HoloTable", new { id = ViewBag.ID })" class="js-delete"><span class="glyphicon glyphicon-cloud-delete"></span> Delete My Data</a></li>
}
</ul>
</div>
}
Expand Down

0 comments on commit 239b021

Please sign in to comment.