Пример #1
0
        public async Task <IResponse <Action> > UpdateAsync(Action model)
        {
            var findedAction = await _authUow.ActionRepo.FindAsync(model.ActionId);

            if (findedAction == null)
            {
                return new Response <Action> {
                           Message = ServiceMessage.RecordNotExist.Fill(DomainStrings.Action)
                }
            }
            ;

            findedAction.Name          = model.Name;
            findedAction.Icon          = model.Icon;
            findedAction.ParentId      = model.ParentId;
            findedAction.ShowInMenu    = model.ShowInMenu;
            findedAction.ActionName    = model.ActionName;
            findedAction.OrderPriority = model.OrderPriority;

            var saveResult = _authUow.ElkSaveChangesAsync();

            return(new Response <Action> {
                Result = findedAction, IsSuccessful = saveResult.Result.IsSuccessful, Message = saveResult.Result.Message
            });
        }
Пример #2
0
        public async Task <IResponse <Action> > AddAsync(Action model)
        {
            await _authUow.ActionRepo.AddAsync(model);

            var saveResult = _authUow.ElkSaveChangesAsync();

            return(new Response <Action> {
                Result = model, IsSuccessful = saveResult.Result.IsSuccessful, Message = saveResult.Result.Message
            });
        }