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