public IActionResult Update(GroupDTO groupDto) { _mapper = GroupMapping.GetMapper().CreateMapper(); Group group = _mapper.Map <GroupDTO, Group>(groupDto); var result = _service.Update(group); if (result.Success) { return(Ok(result.Message)); } return(BadRequest(result.Success.ToString() + " and " + result.Message)); }
public async Task <IActionResult> AddFirmAsync(GroupDTO groupDtO) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessage())); } else { _mapper = GroupMapping.GetMapper().CreateMapper(); Group group = _mapper.Map <GroupDTO, Group>(groupDtO); var GroupResult = await _service.AddAsync(group); if (GroupResult.Success) { return(Ok(GroupResult.Message)); } else { return(BadRequest(GroupResult.Message)); } } }