public async Task <SizeResponse> Update(UpdateSize request) { var requestAccess = _mapper.Map <SizeAccess>(request); var model = await _sizeDataAccess.UpdateAsync(requestAccess); var response = _mapper.Map <SizeResponse>(model); return(response); }
public IActionResult UpdateSize([FromBody] UpdateSize updateSize) { if (_vacancyRepo.UpdateSize(updateSize.No_vacant, updateSize.Mac_address, updateSize.Size)) { Log.Information("Set Size vacancy {size}, {no}, {location} OK.", updateSize.Size, updateSize.No_vacant, _dbContext.lockerMetadatas.FirstOrDefault(x => x.Mac_address == updateSize.Mac_address).Location); return(Ok()); } if (_dbContext.vacancies.FirstOrDefault(x => x.No_vacancy == updateSize.No_vacant && x.Mac_address == updateSize.Mac_address && x.Size == updateSize.Size) != null) { Log.Information("Cannot Set Size vacancy {size}, {no}, {location} OK.", updateSize.Size, updateSize.No_vacant, _dbContext.lockerMetadatas.FirstOrDefault(x => x.Mac_address == updateSize.Mac_address).Location); return(NotFound()); } else { Log.Information("Cannot Set Size vacancy {size}, {no}, {location} OK.", updateSize.No_vacant, updateSize.Mac_address, updateSize.Size); return(NotFound()); } }