public void Add(AddDutyInput input) { input.Validate(); Sys_Duty entity = this.CreateEntity <Sys_Duty>(); entity.Name = input.Name; entity.DepartmentId = input.DepartmentId; entity.SortCode = input.SortCode; this.DbContext.Insert(entity); }
public ActionResult Index() { var service = this.CreateService <IEntityAppService>(); MALU_Users user = service.GetByKey <MALU_Users>(this.CurrentSession.UserId); Sys_Duty duty = string.IsNullOrEmpty(user.DutyId) ? null : service.GetByKey <Sys_Duty>(user.DutyId); Sys_Role role = string.IsNullOrEmpty(user.RoleId) ? null : service.GetByKey <Sys_Role>(user.RoleId); UserModel model = new UserModel(); model.User = user; model.DutyName = duty == null ? null : duty.Name; model.RoleName = role == null ? null : role.Name; this.ViewBag.UserInfo = model; this.ViewBag.CompanyName = this.CurrentSession.CompanyName; return(View()); }