public void LocationEdit(int id, LocationUpdateDto obj) { var locationFromRepository = _repository.GetById(id); var locationModel = _mapper.Map(obj, locationFromRepository); _repository.Update(locationModel); _repository.SaveChanges(); }
public async Task UpdateLocationAsync(LocationUpdateDto dto) { var depo = await Get(dto.DomainId); var location = new Location(dto.Latitude, dto.Longitude); depo.UpdateLocation(location); await Task.WhenAll(_unitOfWork.CompleteAsync(), _cacheStore.RemoveAsync(GetCacheKey(dto.DomainId))); }
public IActionResult Put(int id, [FromBody] LocationDto dto, [FromServices] UpdateLocation command) { var UpdateLocationDto = new LocationUpdateDto { Id = id, CityName = dto.CityName }; _executor.ExecuteCommand(command, UpdateLocationDto); return(StatusCode(StatusCodes.Status204NoContent)); }
public IActionResult EditLocation(int id, LocationUpdateDto model) { var result = _services.GetLocationById(id); if (result == null) { return(NotFound()); } _services.LocationEdit(id, model); return(NoContent()); }
public void Execute(LocationUpdateDto request) { var location = _context.Locations.Find(request.Id); if (location == null) { throw new EntityNotFoundException(request.Id, typeof(Location)); } location.CityName = request.CityName; _context.SaveChanges(); }
public async Task <Result> UpdateLocation([FromBody] LocationUpdateDto dto) { await _depoService.UpdateLocationAsync(dto); return(Result.Success()); }