コード例 #1
0
        public async Task <bool> UpdateMealScheduleEntryAsync(Guid userId, MealScheduleEntryUpdateVM scheduleEntryUpdateVM)
        {
            var mealScheduleEntry = _mapper.Map <MealScheduleEntry>(scheduleEntryUpdateVM);

            mealScheduleEntry.UserId = userId;

            return(await _mealScheduleRepository.UpdateAsync(mealScheduleEntry));
        }
コード例 #2
0
        public async Task <IActionResult> UpdateMealScheduleEntry([FromBody] MealScheduleEntryUpdateVM scheduleEntryUpdate)
        {
            var userId = new Guid(User.Identity.Name);

            bool updated = await _mealScheduleService.UpdateMealScheduleEntryAsync(userId, scheduleEntryUpdate);

            if (updated)
            {
                return(Ok());
            }
            else
            {
                return(Unauthorized());
            }
        }