public ActionResult Create(BookingCosmeticServiceModel bookingCosmeticServiceModel) { if (!ModelState.IsValid) { return(View("Create", bookingCosmeticServiceModel)); } ; BookingCosmeticService bookingCosmeticService = new BookingCosmeticService(); if (bookingCosmeticServiceModel.ServiceId != null) { Console.WriteLine("Error"); } bookingCosmeticService.ServiceId = bookingCosmeticServiceModel.ServiceId.HasValue ? bookingCosmeticServiceModel.ServiceId.Value : 0; bookingCosmeticService.Nameservice = bookingCosmeticServiceModel.Nameservice; bookingCosmeticService.Price = bookingCosmeticServiceModel.Price; bookingCosmeticService.VisitData = bookingCosmeticServiceModel.VisitData; bookingCosmeticService.MasterName = bookingCosmeticServiceModel.MasterName; bookingCosmeticService.FirstName = bookingCosmeticServiceModel.FirstName; bookingCosmeticService.LastName = bookingCosmeticServiceModel.LastName; bookingCosmeticService.Phone = bookingCosmeticServiceModel.Phone; cosmeticServiceService.Create(bookingCosmeticService); 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")); }