Delete service reminder and vehicle service
This commit is contained in:
@@ -21,14 +21,6 @@ namespace MileageTraker.Web.Controllers
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Delete(int id)
|
||||
{
|
||||
var serviceReminder = DataService.GetServiceReminder(id);
|
||||
var vehicleId = serviceReminder.Vehicle.VehicleId;
|
||||
DataService.DeleteServiceReminder(id);
|
||||
return RedirectToAction("Index", new { vehicleId });
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[RequireRequestValue("vehicleId")]
|
||||
public ActionResult Create(string vehicleId)
|
||||
@@ -94,5 +86,24 @@ namespace MileageTraker.Web.Controllers
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Delete(int id)
|
||||
{
|
||||
var vehicleService = DataService.GetServiceReminder(id);
|
||||
var viewModel = new ServiceReminderViewModel(vehicleService);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ActionLog]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
var serviceReminder = DataService.GetServiceReminder(id);
|
||||
var vehicleId = serviceReminder.Vehicle.VehicleId;
|
||||
DataService.DeleteServiceReminder(id);
|
||||
|
||||
SetStatusMessage("Service Reminder deleted");
|
||||
return RedirectToAction("Index", new { vehicleId });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,6 +193,23 @@ namespace MileageTraker.Web.Controllers
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Delete(int id)
|
||||
{
|
||||
var vehicleService = DataService.GetVehicleService(id);
|
||||
var viewModel = new VehicleServiceViewModel(vehicleService);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ActionLog]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
DataService.DeleteVehicleService(id);
|
||||
|
||||
SetStatusMessage("Vehicle Service deleted");
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ActionLog]
|
||||
public ActionResult Edit(VehicleServiceViewModel viewModel)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
@model MileageTraker.Web.ViewModels.ServiceReminder.ServiceReminderViewModel
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Delete Service Reminder";
|
||||
}
|
||||
|
||||
@Html.Partial("_StatusMessage")
|
||||
|
||||
<h2 class="center-content"><i class="fa fa-clock-o"></i> @ViewBag.Title</h2>
|
||||
|
||||
<div class="center-content label label-warning">Are you sure you wish to delete this service reminder?</div>
|
||||
|
||||
<div class="center-content well">
|
||||
|
||||
@Html.DisplayForModel()
|
||||
|
||||
@using (Html.BeginForm("Delete", "ServiceReminder", FormMethod.Post, new { @class = "form-horizontal" }))
|
||||
{
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="Delete" class="btn btn-warning" />
|
||||
@Html.ActionLink("Cancel", "Index", new { id = Model.VehicleId }, new { @class = "btn" })
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -13,4 +13,5 @@
|
||||
|
||||
<div class="center-content btn-toolbar">
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ServiceReminderId }, new { @class = "btn" })
|
||||
@Html.ActionLink("Delete", "Delete", new { id = Model.ServiceReminderId }, new { @class = "btn" })
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
@model MileageTraker.Web.ViewModels.VehicleService.VehicleServiceViewModel
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Delete Vehicle Service";
|
||||
}
|
||||
|
||||
@Html.Partial("_StatusMessage")
|
||||
|
||||
<h2 class="center-content"><i class="fa fa-wrench"></i> @ViewBag.Title</h2>
|
||||
|
||||
<div class="center-content label label-warning">Are you sure you wish to delete this service?</div>
|
||||
|
||||
<div class="center-content well">
|
||||
|
||||
@Html.DisplayForModel()
|
||||
|
||||
@using (Html.BeginForm("Delete", "VehicleService", FormMethod.Post, new { @class = "form-horizontal" }))
|
||||
{
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="Delete" class="btn btn-warning" />
|
||||
@Html.ActionLink("Cancel", "Details", new { id = Model.VehicleServiceId }, new { @class = "btn" })
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -13,5 +13,6 @@
|
||||
|
||||
<div class="center-content btn-toolbar">
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.VehicleServiceId }, new { @class = "btn" })
|
||||
@Html.ActionLink("Delete", "Delete", new { id = Model.VehicleServiceId }, new { @class = "btn" })
|
||||
@Html.ActionLink("Vehicle Details", "Details", "Vehicle", new { id = Model.VehicleId }, new{@class="btn"})
|
||||
</div>
|
||||
@@ -54,6 +54,7 @@
|
||||
grid.Column(format:
|
||||
@<div class='btn-group'>
|
||||
@Html.ActionLink("Details", "Details", new { id = item.VehicleServiceId }, new { @class = "btn btn-mini" })
|
||||
@Html.ActionLink("Delete", "Delete", new { id = item.VehicleServiceId }, new { @class = "btn btn-mini" })
|
||||
</div>)
|
||||
),
|
||||
htmlAttributes: new { @class = "table table-striped table-bordered table-hover table-condensed"},
|
||||
|
||||
@@ -394,6 +394,8 @@
|
||||
<Content Include="Views\Vehicle\VehicleCostReport.cshtml" />
|
||||
<Content Include="Views\Vehicle\VehicleCostIndex.cshtml" />
|
||||
<Content Include="Views\Shared\PageTitle.cshtml" />
|
||||
<Content Include="Views\VehicleService\Delete.cshtml" />
|
||||
<Content Include="Views\ServiceReminder\Delete.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Account.Login.css" />
|
||||
|
||||
Reference in New Issue
Block a user