public ViewResult Edit(string id) { AbsenceType absenceType = data.AbsenceTypes.Get(id); AbsenceTypeViewModel model = new AbsenceTypeViewModel { AbsenceTypeId = absenceType.AbsenceTypeId, Name = absenceType.Name }; return(View("AbsenceType", model)); }
public ActionResult Create() { var viewModel = new AbsenceTypeViewModel { AbsenceType = new AbsenceType() { OrganisationId = UserOrganisationId, }, ColoursList = NidanBusinessService.RetrieveColours().ToList() }; return(View(viewModel)); }
public IActionResult Update(int id) { AbsenceType absenceType = absenceTypeService.GetById(id); AbsenceTypeViewModel model = new AbsenceTypeViewModel { Id = absenceType.Id, IsHourly = absenceType.IsHourly, Name = absenceType.Name }; return(View(model)); }
public IActionResult Update(AbsenceTypeViewModel model) { if (ModelState.IsValid) { absenceTypeService.Update(new AbsenceType { Id = model.Id, IsHourly = model.IsHourly, Name = model.Name }); return(RedirectToAction("Index")); } return(View(model)); }
public IActionResult Add(AbsenceTypeViewModel model) { if (ModelState.IsValid) { AbsenceType absenceType = new AbsenceType { Name = model.Name, IsHourly = model.IsHourly }; absenceTypeService.Add(absenceType); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var absenceType = NidanBusinessService.RetrieveAbsenceType(UserOrganisationId, id.Value); AbsenceName = absenceType.Name; var viewmodel = new AbsenceTypeViewModel() { AbsenceType = absenceType, ColoursList = NidanBusinessService.RetrieveColours().ToList() }; return(View(viewmodel)); }
public IActionResult Add(AbsenceTypeViewModel model) { if (ModelState.IsValid) { AbsenceType absenceType = new AbsenceType { Name = model.Name }; data.AbsenceTypes.Insert(absenceType); data.Save(); TempData["SucessMessage"] = "The Absence Type, " + model.Name + ", was created successfully."; return(RedirectToAction("List")); } return(View("AbsenceType", model)); }
public ActionResult Create() { var viewModel = new AbsenceTypeViewModel { AbsenceType = new AbsenceType() { OrganisationId = UserOrganisationId, }, ColoursList = HRBusinessService.RetrieveColours().ToList(), }; var firstOrDefault = viewModel.ColoursList.FirstOrDefault(); if (firstOrDefault != null) { viewModel.AbsenceType.ColourId = firstOrDefault.ColourId; } return(View(viewModel)); }
public IActionResult Edit(AbsenceTypeViewModel model) { if (ModelState.IsValid) { AbsenceType absenceType = new AbsenceType { AbsenceTypeId = model.AbsenceTypeId, Name = model.Name }; data.AbsenceTypes.Update(absenceType); data.Save(); TempData["SucessMessage"] = "The Absence Type with ID# " + model.AbsenceTypeId + ", was updated successfully."; return(RedirectToAction("List")); } return(View("AbsenceType", model)); }
public ViewResult Add() { AbsenceTypeViewModel model = new AbsenceTypeViewModel(); return(View("AbsenceType", model)); }