// GET: /<controller>/ public IActionResult Index() { OffenceModel offence = new OffenceModel() { nom = "lachheb", prenom = "Ahmedd" }; return(View(offence)); }
public ActionResult Offence(uint id) { OffenceModel offenceModel = null; Offence offence = DataProvider.OffenceRepository.GetOffenceByID((int)(id)); if (offence != null) { offenceModel = new OffenceModel(offence.DateCreatedUtc, offence.DateUpdatedUtc, offence.ID, offence.IsDeleted, offence.IsVisible, offence.Name, offence.OffenceCategoryID); } return(View(offenceModel)); }
public ActionResult NewOffence(OffenceModel offenceModel) { ActionResult actionResult = null; if (ModelState.IsValid == true) { DataProvider.OffenceRepository.AddOffence(offenceModel.IsDeleted, offenceModel.IsVisible, offenceModel.Name); actionResult = RedirectToAction("Offences", "Admin"); } else { actionResult = View(offenceModel); } return(actionResult); }
public ActionResult Offence(OffenceModel offenceModel) { ActionResult actionResult = null; if (ModelState.IsValid == true) { if (offenceModel.IsDelete == true) { // Can't delete them at this time } else { DataProvider.OffenceRepository.UpdateOffence(offenceModel.ID, offenceModel.IsDeleted, offenceModel.IsVisible, offenceModel.Name, offenceModel.OffenceCategoryID); } actionResult = RedirectToAction("Offences", "Admin"); } else { actionResult = View(offenceModel); } return(actionResult); }