public IHttpActionResult Add([FromBody] TblTransformationCategoryDto transformationCategoryDto) { var data = this.transformationCategoryService.GetByNameAndWebsiteId(transformationCategoryDto.Name, transformationCategoryDto.WebsiteId); if (!data.IsError) { data.Messages.Add(new Message(null, "transformationCategory already exists with '" + transformationCategoryDto.Name + "' Name!")); return(this.CreateCustomResponse(data, HttpStatusCode.BadRequest)); } return(this.AddUpdate(transformationCategoryDto)); }
/// <summary> /// Adds the update. /// </summary> /// <param name="transformationCategoryDto">The transformationCategory dto.</param> /// <returns> /// Newly added object /// </returns> private IHttpActionResult AddUpdate(TblTransformationCategoryDto transformationCategoryDto) { var result = new ResultMessage <TblTransformationCategoryDto>(); try { result = this.transformationCategoryService.SaveOrUpdate(transformationCategoryDto, this.UserId); } catch (Exception ex) { this.LoggerService.LogException(ex); result.Messages.Add(new Message(null, ex.Message)); } return(this.CreateCustomResponse(result)); }