コード例 #1
0
        public IHttpActionResult Add([FromBody] TblPagesDto pagesDto)
        {
            var data = this.pagesService.GetByValue(pagesDto.Value, pagesDto.WebsiteId);

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

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

            return(this.AddUpdate(pagesDto));
        }
コード例 #2
0
        /// <summary>
        /// Adds the update.
        /// </summary>
        /// <param name="pagesDto">The display name dto.</param>
        /// <returns>
        /// Newly added object
        /// </returns>
        private IHttpActionResult AddUpdate(TblPagesDto pagesDto)
        {
            var result = new ResultMessage <TblPagesDto>();

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

            return(this.CreateCustomResponse(result));
        }