public bool AddRole(SystemRole objRole) { try { return true; } catch { return false; } }
public JsonResult SaveRole(SystemRole objRole) { if (objRole.RoleID > 0) { var result = AppGlobal.Services.BusinessRole.UpdateRole(objRole); return Json(new { success = result ? 1 : 0, errormessages = ErrorMessages }); } else { ErrorMessages = Mobile.Core.Mvc.Validation.ModelValidation.Validate(objRole, this.ControllerContext).ToList(); if (ErrorMessages.Count > 0) { return Json(new { success = 0, errormessages = ErrorMessages }); } var result = AppGlobal.Services.BusinessRole.AddRole(objRole); return Json(new { success = result ? 1 : 0, errormessages = ErrorMessages }); } }
public bool UpdateRole(SystemRole objRole) { try { var existObj = GetRole(objRole.RoleID); existObj.Description = objRole.Description; existObj.IsActived = objRole.IsActived; existObj.ModifiedBy = objRole.ModifiedBy; existObj.ModifiedDate = DateTime.Now; existObj.RoleName = objRole.RoleName; repSystemRole.Update(existObj); SaveChanges(); return true; } catch { return false; } }