public ActionResult Edit(ROLEGROUP rOLEGROUP) { if (new RoleGroupDAO().Edit(rOLEGROUP)) { SetAlert("Successfully edited!", "success"); } else { SetAlert("Editing failed, please try again!", "warning"); } return(RedirectToAction("Index", "RoleGroup")); }
public ActionResult Create(ROLEGROUP rOLEGROUP) { var result = new RoleGroupDAO().Create(rOLEGROUP); if (result) { SetAlert("Added successfully!", "success"); } else { SetAlert("Add failed, please try again!", "warning"); } return(RedirectToAction("Index", "RoleGroup")); }
public bool Edit(ROLEGROUP rOLEGROUP) { try { var data = db.ROLEGROUPs.Find(rOLEGROUP.ROLEGROUP_Id); data.ROLEGROUP_Code = rOLEGROUP.ROLEGROUP_Code.ToUpper(); data.ROLEGROUP_Name = rOLEGROUP.ROLEGROUP_Name; db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Create(ROLEGROUP rOLEGROUP) { try { Guid id = Guid.NewGuid(); rOLEGROUP.ROLEGROUP_Id = id; rOLEGROUP.ROLEGROUP_Code = rOLEGROUP.ROLEGROUP_Code.ToUpper(); db.ROLEGROUPs.Add(rOLEGROUP); db.SaveChanges(); AddRoletoRoleGroup(id); return(true); } catch (Exception) { return(false); } }