public IActionResult Create([FromBody] ReasonForRejectionDTO dto) { var Res = _Mapper.Map <ReasonForRejection>(dto); try { var country = _reasonForRejection.SaveOrUpdateAsync(Res); return(Ok(country)); } catch (AppException ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Details(int?id, ReasonForRejectionDTO dto) { if (id == null) { return(NotFound()); } var country = await _reasonForRejection.GetByIdAsync(id); var cto = _Mapper.Map <CountryDTO>(country); if (country == null) { return(NotFound()); } return(Ok(cto)); }
public IActionResult Update(int id, [FromBody] ReasonForRejectionDTO dto) { // map dto to entity and set id var rsofre = _Mapper.Map <ReasonForRejection>(dto); rsofre.Id = id; try { // save _reasonForRejection.UpdateAsync(rsofre, id); return(Ok()); } catch (AppException ex) { // return error message if there was an exception return(BadRequest(ex.Message)); } }