// GET: CosmeticService public ActionResult Update(int id) { var cosmeticServicemodel = new CosmeticServiceModel(); var cosmeticService = cosmeticServiceService.GetByIdCosmeticService(id); cosmeticServicemodel.Id = cosmeticService.Id; cosmeticServicemodel.Nameservice = cosmeticService.Nameservice; cosmeticServicemodel.Price = cosmeticService.Price; return(View("Update", cosmeticServicemodel)); }
public ActionResult Update(CosmeticServiceModel cosmeticServicemodel) { if (!ModelState.IsValid) { return(View("Update", cosmeticServicemodel)); } ; CosmeticService cosmeticService = new CosmeticService(); cosmeticService.Id = cosmeticServicemodel.Id.HasValue ? cosmeticServicemodel.Id.Value : 0; cosmeticService.Nameservice = cosmeticServicemodel.Nameservice; cosmeticService.Price = cosmeticServicemodel.Price; cosmeticServiceService.Edit(cosmeticService); return(RedirectToAction("Index")); }
public ActionResult Create(CosmeticServiceModel cosmeticServicemodel) { if (!ModelState.IsValid) { return(View("Create", cosmeticServicemodel)); } ; CosmeticService cosmeticService = new CosmeticService(); if (cosmeticServicemodel.Id != null) { Console.WriteLine("Error"); } cosmeticService.Id = cosmeticServicemodel.Id.HasValue ? cosmeticServicemodel.Id.Value : 0; cosmeticService.Nameservice = cosmeticServicemodel.Nameservice; cosmeticService.Price = cosmeticServicemodel.Price; cosmeticServiceService.Create(cosmeticService); return(RedirectToAction("Index")); }
// GET: CosmeticService public ActionResult Create(int id = 0) { var cosmeticServicemodel = new CosmeticServiceModel(); return(View("Create", cosmeticServicemodel)); }