Пример #1
0
        public IHttpActionResult Add([FromBody] TblGroupUserDto actionDto)
        {
            var data = this.groupUserService.GetByGroupIdAndUserIdEitherDeletedOrNonDeleted(actionDto.GroupId, actionDto.UserId);

            if (!data.IsError && data.Item.IsDeleted)
            {
                data.Item.IsDeleted = false;
                return(this.AddUpdate(data.Item));
            }

            return(this.AddUpdate(actionDto));
        }
Пример #2
0
        /// <summary>
        /// Adds the update.
        /// </summary>
        /// <param name="groupUserDto">The action dto.</param>
        /// <returns>Newly added object</returns>
        private IHttpActionResult AddUpdate(TblGroupUserDto groupUserDto)
        {
            var result = new ResultMessage <TblGroupUserDto>();

            try
            {
                result = this.groupUserService.SaveOrUpdate(groupUserDto, this.UserId);
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException(ex);
                result.Messages.Add(new Message(null, ex.Message));
            }

            return(this.CreateCustomResponse(result));
        }