public async Task <bool> UpdateMealScheduleEntryAsync(Guid userId, MealScheduleEntryUpdateVM scheduleEntryUpdateVM)
        {
            var mealScheduleEntry = _mapper.Map <MealScheduleEntry>(scheduleEntryUpdateVM);

            mealScheduleEntry.UserId = userId;

            return(await _mealScheduleRepository.UpdateAsync(mealScheduleEntry));
        }
Exemple #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());
            }
        }