public void Update(TMSResignReasonViewModel Vm) { var data = _mapper.Map <TMSResignReasonViewModel, TMSResignReason>(Vm); _tmsResignReasonRepository.Update(data); SaveChanges(); }
public TMSResignReason Add(TMSResignReasonViewModel Vm) { var entity = _mapper.Map <TMSResignReasonViewModel, TMSResignReason>(Vm); _tmsResignReasonRepository.Add(entity); SaveChanges(); return(entity); }
public IActionResult Update([FromBody] TMSResignReasonViewModel Vm) { if (!ModelState.IsValid) { var allErrors = ModelState.Values.SelectMany(v => v.Errors); return(new BadRequestObjectResult(new GenericResult(false, allErrors))); } else { try { _tmsResignReasonService.Update(Vm); return(new OkObjectResult(new GenericResult(true, "Update Success"))); } catch (Exception ex) { return(new OkObjectResult(new GenericResult(false, ex.Message))); } } }