public void Update(Group model) { var target = Find(model.ID); db.Attach<Group>(target); target.Name = model.Name; target.Description = model.Description; db.Commit(); }
public Group Create(GroupViewModel model) { var entity = new Group(); entity.Name = model.Name; entity.Description = model.Description; if (!string.IsNullOrEmpty(model.RoleID)) { var RoleArray = Utilities.GetIdList(model.RoleID); var RoleList = RoleService.GetALL().Where(x => RoleArray.Contains(x.ID)); entity.Role.AddRange(RoleList); } db.Add<Group>(entity); db.Commit(); return entity; }
public void Delete(Group model) { var target = Find(model.ID); db.Remove<Group>(target); db.Commit(); }
public void Create(Group model) { db.Add<Group>(model); db.Commit(); }