Exemple #1
0
        public IHttpActionResult Add([FromBody] TblActionDto actionDto)
        {
            var data = this.actionsService.GetByValue(actionDto.Value);

            if (!data.IsError)
            {
                data.Messages.Add(new Message(null, "Action already exists with '" + actionDto.Value + "' value!"));

                return(this.CreateCustomResponse(data, HttpStatusCode.BadRequest));
            }

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

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

            return(this.CreateCustomResponse(result));
        }