public IActionResult DichVuChiTietAdd() { ViewBag.Category = db.tbservices; var model = new Tbservicedetail(); return(View(model)); }
public void SaveDichVuChiTiet(Tbservicedetail model) { if (model.ServicedetailId == 0) { context.Tbservicedetail.Add(model); } else { Tbservicedetail servicedetail = context.Tbservicedetail .FirstOrDefault(p => p.ServicedetailId == model.ServicedetailId); if (servicedetail != null) { servicedetail.ServicedetailTitle = model.ServicedetailTitle; servicedetail.ServiceId = model.ServiceId; servicedetail.ServicedetailContent = model.ServicedetailContent; } } context.SaveChanges(); }
public ActionResult DichVuChiTietEdit(Tbservicedetail servicedetail) { db.SaveDichVuChiTiet(servicedetail); return(RedirectToAction("DichVuChiTiet")); }