Exemple #1
0
        public Page <Sys_UserGroup> FindPage(UserGroupVM form)
        {
            Expression <Func <Sys_UserGroup, bool> > predicate = Ext.True <Sys_UserGroup>();
            OrderModelField idOrder = new OrderModelField
            {
                PropertyName = "Id",
                IsDESC       = false
            };

            OrderModelField[] orderByExpression = new OrderModelField[] {
                idOrder
            };

            Page <Sys_UserGroup> page = this._userGroupRepository.FindPage(ContextDB.managerDBContext, predicate, orderByExpression, form.page, form.rows);

            return(page);
        }
 public ActionResult <UserGroup> GetUserGroup(Guid ID)
 {
     try
     {
         var rs = _userGroupService.GetByID(ID);
         if (rs == null)
         {
             return(NotFound("ID not found"));
         }
         UserGroupVM result = _mapper.Map <UserGroupVM>(rs);
         return(Ok(result));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemple #3
0
 public string UserGroupEdit(UserGroupVM form, int type = 0)
 {
     try
     {
         this._userGroupService.Update(form);
         return(ResponseJson.Success());
     }
     catch (BaseException ex)
     {
         _logger.Info(ex.GetMessage());
         return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage()));
     }
     catch (Exception ex)
     {
         _logger.Info(ex.Message);
         return(ResponseJson.Error(ex.Message));
     }
 }
Exemple #4
0
        public ActionResult Edit(int id = 0)
        {
            var userGroup = _userGroupService.GetUserGroup(c => c.Id == id);

            if (userGroup == null)
            {
                return(PartialView("Create", new UserGroupVM()));
            }
            var model = new UserGroupVM()
            {
                Id          = userGroup.Id,
                GroupName   = userGroup.GroupName,
                Description = userGroup.Description,
                OrderSort   = userGroup.OrderSort,
                Enabled     = userGroup.Enabled,
            };

            return(PartialView("Create", model));
        }
Exemple #5
0
        public bool Delete(UserGroupVM entity)
        {
            UserGroup uGroup = new UserGroup()
            {
                ID        = entity.ID,
                Code      = entity.Code,
                ARName    = entity.ARName,
                LatName   = entity.LatName,
                Notes     = entity.Notes,
                AddedBy   = entity.AddedBy,
                AddedOn   = entity.AddedOn,
                Disable   = entity.Disable,
                UpdatedBy = entity.UpdatedBy,
                updatedOn = entity.updatedOn
            };

            userGroupRepo.Delete(uGroup, entity.ID);
            return(true);
        }
Exemple #6
0
 public Task <bool> DeleteAsync(UserGroupVM entity)
 {
     return(Task.Run <bool>(() =>
     {
         UserGroup uGroup = new UserGroup()
         {
             ID = entity.ID,
             Code = entity.Code,
             ARName = entity.ARName,
             LatName = entity.LatName,
             Notes = entity.Notes,
             AddedBy = entity.AddedBy,
             AddedOn = entity.AddedOn,
             Disable = entity.Disable,
             UpdatedBy = entity.UpdatedBy,
             updatedOn = entity.updatedOn
         };
         userGroupRepo.Delete(uGroup, entity.ID);
         return true;
     }));
 }
Exemple #7
0
 public Task <int> InsertAsync(UserGroupVM entity)
 {
     return(Task.Run <int>(() =>
     {
         UserGroup uGroup = new UserGroup()
         {
             ID = entity.ID,
             Code = entity.Code,
             ARName = entity.ARName,
             LatName = entity.LatName,
             Notes = entity.Notes,
             AddedBy = entity.AddedBy,
             AddedOn = entity.AddedOn,
             Disable = entity.Disable,
             UpdatedBy = entity.UpdatedBy,
             updatedOn = entity.updatedOn
         };
         userGroupRepo.Add(uGroup);
         return uGroup.ID;
     }));
 }
Exemple #8
0
 public Sys_UserGroup GetUserGroup(UserGroupVM form)
 {
     return(this._userGroupRepository.Entity(ContextDB.managerDBContext, t => t.Id == form.Id));
 }
Exemple #9
0
 public int Delete(UserGroupVM form)
 {
     return(this._userGroupRepository.Delete(ContextDB.managerDBContext, t => t.Id == form.Id));
 }
Exemple #10
0
        public ActionResult Create()
        {
            var model = new UserGroupVM();

            return(PartialView(model));
        }
Exemple #11
0
        public async Task <ActionResult> DeleteUserGroup(UserGroupVM Model)
        {
            await db.DeleteUserGroup(Model.Id);

            return(null);
        }
Exemple #12
0
        public async Task <ActionResult> CancelUserGroup(UserGroupVM Model)
        {
            await Model.Update();

            return(PartialView("Partial/_UserGroupRow", Model));
        }
Exemple #13
0
 public override BussinessCustomResponse <UserGroupVM> Update(UserGroupVM entityToUpdateVM)
 {
     return(base.Update(entityToUpdateVM));
 }
Exemple #14
0
 public UserGroupView(UserGroupVM vm)
 {
     InitializeComponent();
     ViewModel = vm;
 }