public async Task <IActionResult> Update(UpdateInterestRequest user) { var command = new UpdateInterestCommand(user); var result = await Mediator.Send(command); return(await ResponseBase(result)); }
public IActionResult UpdateInterests(string name, UpdateInterestCommand newInterest) { var repo = new InmateRepository(); var newCriminalInterest = repo.UpdateInterest(name, newInterest.CriminalInterest); return(Ok(newCriminalInterest)); }
public IActionResult UpdateInmateInterest(UpdateInterestCommand updateInterestCommand, int id) { var repo = new InmateRepository(); var inmateInterestGotUpdated = repo.updateInmateInterest(updateInterestCommand.Interests, id); return(Ok(inmateInterestGotUpdated)); }
public async Task <BaseResponse <InterestResponse> > Handle(UpdateInterestCommand request, CancellationToken cancellationToken) { var interest = _mapper.Map <MetWorkingUserDomain.Entities.Interest>(request.UpdateInterestRequest); var interestInDb = await _applicationDbContext.Interest.FindAsync(interest.Id); var response = new BaseResponse <InterestResponse>(); if (interestInDb == null) { response.SetValidationErrors(new [] { "Interest not found!" }); return(response); } interestInDb.Description = interest.Description; interestInDb.Name = interest.Name; await _applicationDbContext.SaveChangesAsync(cancellationToken); var interestResponse = _mapper.Map <InterestResponse>(interestInDb); response.SetIsOk(interestResponse); return(response); }