public ActionResult EditTypeProduct(long id) { var dao = new TypeProductDao(); var model = dao.GetTypeProduct(id); return(View(model)); }
public ActionResult EditTypeProduct(type_products TypeProduct) { if (ModelState.IsValid) { var dao = new TypeProductDao(); var CreatedAt = dao.GetTypeProduct(TypeProduct.id).created_at; TypeProduct.created_at = CreatedAt; TypeProduct.updated_at = DateTime.Now; dao.EditTypeProduct(TypeProduct); TempData["success"] = "Edited Successfully"; return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Fail Edit"); return(View("Index")); } }