public void Update(Role model) { var target = Find(model.ID); db.Attach<Role>(target); target.Name = model.Name; target.Description = model.Description; db.Commit(); }
public Role Create(RoleViewModel model) { var entity = new Role(); entity.Name = model.Name; entity.Description = model.Description; if (!string.IsNullOrEmpty(model.ActionID)) { var ActionArray = Utilities.GetIdList(model.ActionID); var ActionList = ActionService.GetALL().Where(x => ActionArray.Contains(x.ID)); entity.Action.AddRange(ActionList); } db.Add<Role>(entity); db.Commit(); return entity; }
public void Delete(Role model) { var target = Find(model.ID); db.Remove<Role>(target); db.Commit(); }
public void Create(Role model) { db.Add<Role>(model); db.Commit(); }