Exemplo n.º 1
0
 public MinuteService SetMinuteServiceDtoToMinuteService(SetMinuteServiceDto setMinuteServiceDto)
 {
     return(new MinuteService
     {
         Name = setMinuteServiceDto.Name,
         Description = setMinuteServiceDto.Description,
         PricePerMinute = setMinuteServiceDto.PricePerMinute,
         MinTime = setMinuteServiceDto.MinTime,
         MaxTime = setMinuteServiceDto.MaxTime,
         IsAvailable = setMinuteServiceDto.IsAvailable
     });
 }
        public async Task <IActionResult> Edit(int id, SetMinuteServiceDto setMinuteServiceDto)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                await _minuteServiceService.UpdateMinuteServiceAsync(id, setMinuteServiceDto);

                return(RedirectToAction("show", "minuteservice", new { id = id }));
            }
            catch (Exception e)
            {
                if (e is FormatException ||
                    e is NullReferenceException ||
                    e is KeyNotFoundException)
                {
                    Console.WriteLine(e.Message);
                    return(NotFound());
                }
                throw;
            }
        }
Exemplo n.º 3
0
 public async Task <int> UpdateMinuteServiceAsync(int id, SetMinuteServiceDto setMinuteServiceDto)
 {
     return(await _repository.UpdateAsync(id, _converter.SetMinuteServiceDtoToMinuteService(setMinuteServiceDto)));
 }