Exemplo n.º 1
0
        public async Task <UnitDto> UpdateUnitAsync(UpdateUnitInput input)
        {
            var entity = await _menuRepository.GetAsync(input.Id);

            ObjectMapper.Map(input, entity);
            entity = await _menuRepository.UpdateAsync(entity);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(ObjectMapper.Map <UnitDto>(entity));
        }
Exemplo n.º 2
0
 public OutputBase UpdateUnit(UpdateUnitInput input)
 {
     if (_unitRepository.Query(q => q.Any(u => u.Name == input.Name && u.Id != input.Id)))
     {
         return(new OutputBase {
             Message = "A unit with the same name already exists", Success = false
         });
     }
     _unitRepository.Update(Mapper.Map <Unit>(input));
     return(new OutputBase {
         Message = "Unit updated", Success = true
     });
 }
Exemplo n.º 3
0
 public async Task <UnitDto> UpdateUnit([FromBody] UpdateUnitInput input)
 {
     return(await _UnitAppService.UpdateUnitAsync(input));
 }