Пример #1
0
        public async Task <int> Update(SparePartUpdateDto dto, int id, string userId)
        {
            var oldSparePart = await _dbContext.SpareParts.FindAsync(id);

            var updatedSparePart = _mapper.Map(dto, oldSparePart);

            _dbContext.SpareParts.Update(updatedSparePart);

            await _dbContext.SaveChangesAsync();

            return(updatedSparePart.Id);
        }
Пример #2
0
 public async Task <IActionResult> Update([FromBody] SparePartUpdateDto dto, int id)
 => await GetResponse(async (userId) =>
                      new ApiResponseViewModel(true, "SparePart Updated Successfully", await _service.Update(dto, id, userId)));