Пример #1
0
 public void Update(Group model)
 {
     var target = Find(model.ID);
     db.Attach<Group>(target);
     target.Name = model.Name;
     target.Description = model.Description;
     db.Commit();
 }
Пример #2
0
        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;
        }
Пример #3
0
 public void Delete(Group model)
 {
     var target = Find(model.ID);
     db.Remove<Group>(target);
     db.Commit();
 }
Пример #4
0
 public void Create(Group model)
 {
     db.Add<Group>(model);
     db.Commit();
 }