public ActionResult Edit(tbl_module modulemodel) { try { o_module = obj.tbl_module.Where(x => x.ID == modulemodel.ID).FirstOrDefault(); o_module.Module_Name = modulemodel.Module_Name; o_module.Updatedby = "Admin"; o_module.UpdateTS = DateTime.UtcNow; obj.SaveChanges(); return(RedirectToAction("Index")); } catch (DbUpdateException ex) { SqlException innerException = ex.InnerException.InnerException as SqlException; if (innerException != null && (innerException.Number == 2627 || innerException.Number == 2601)) { ViewData["error"] = "Module already exists!"; return(View(o_module)); } else { throw; } } catch (Exception ex) { ViewData["error"] = "An error occured. Please try again!"; return(View(o_module)); } }
public void AddTotbl_module(tbl_module tbl_module) { base.AddObject("tbl_module", tbl_module); }
public static tbl_module Createtbl_module(int id) { tbl_module tbl_module = new tbl_module(); tbl_module.ID = id; return tbl_module; }