public Guid CreateMeal(MealViewModel mealViewModel, Guid userId) { Meal meal = new Meal { Name = mealViewModel.Name, Calories = mealViewModel.Calories, MealType = mealViewModel.MealType, DateCreated = mealViewModel.DateCreated, UserId = userId }; _mealRepository.Create(meal); return(meal.Id); }
public IActionResult Create(Meal meal) { meal.Cook = _studentRepository.Students.Where(e => e.Id == User.FindFirstValue(ClaimTypes.NameIdentifier)).FirstOrDefault(); IActionResult actionResult = View(meal); bool? result = _mealRepository.Create(meal); if (result == true) { actionResult = Redirect("/Meal"); } else if (result == null) { ModelState.AddModelError("Date", "A meal is already planned on this day"); } return(actionResult); }
public long Execute() { return(mealRepository.Create(Meal)); }
public async Task Create(MealDto entityDto) { await _mealRepository.Create(entityDto); }