public async Task <IActionResult> PostponeAsync(int id, PostponeInputModel im)
        {
            var operationResult = await _remindersSvc.PostponeAsync(id, im);

            if (operationResult.IsValid)
            {
                return(Ok(operationResult.Data));
            }

            return(BadRequest(operationResult.Errors));
        }
예제 #2
0
        public async Task <OperationResult <ReminderViewModel> > PostponeAsync(int id, PostponeInputModel im)
        {
            var reminder = await _reminderDomainRepository.GetByIdAsync(id);

            if (reminder == null)
            {
                OperationResult <ReminderViewModel> .Error(
                    "TODO: ErrorCode",
                    $"Reminder {id} doesn't exist");
            }

            var result = reminder.Postpone(im.RemindOn);

            if (result.IsSuccess)
            {
                _reminderDomainRepository.Update(reminder);
                await _unitOfWork.SaveAsync();
            }

            return(MapToVM(result));
        }