Пример #1
0
        public async Task <int> Update(CollectionCommissionUpdateDto dto, int id, string userId)
        {
            var oldCollectionCommission = await _dbContext.CollectionCommissions
                                          .Include(x => x.CollectedByEmp)
                                          .SingleOrDefaultAsync(x => x.Id == id);

            var updatedCollectionCommission = _mapper.Map(dto, oldCollectionCommission);

            updatedCollectionCommission.UpdatedBy = userId;
            updatedCollectionCommission.UpdateAt  = DateTime.Now;

            _dbContext.CollectionCommissions.Update(updatedCollectionCommission);
            await _dbContext.SaveChangesAsync();

            return(updatedCollectionCommission.Id);
        }
 public async Task <IActionResult> Update([FromBody] CollectionCommissionUpdateDto dto, int id)
 => await GetResponse(async (userId) =>
                      new ApiResponseViewModel(true, "CollectionCommission Updated Successfully", await _service.Update(dto, id, userId)));