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