예제 #1
0
 public ActionResult Cadastrar([Bind(Include = "idMeal,strMeal,strCategory,strArea,strInstructions,strMealThumb,strTags,strYoutube,strIngredient1,strIngredient2,strIngredient3,strIngredient4,strIngredient5,strIngredient6,strIngredient7,strIngredient8,strIngredient9,strIngredient10,strIngredient11,strIngredient12,strIngredient13,strIngredient14,strIngredient15,strMeasure1,strMeasure2,strMeasure3,strMeasure4,strMeasure5,strMeasure6,strMeasure7,strMeasure8,strMeasure9,strMeasure10,strMeasure11,strMeasure12,strMeasure13,strMeasure14,strMeasure15")] Meal meal)
 {
     ViewBag.Usuario = User.Identity.Name;
     if (ModelState.IsValid)
     {
         if (Request.IsAuthenticated)
         {
             meal.Usuario = ViewBag.Usuario;
         }
         else
         {
             meal.Usuario = "Desconhecido";
         }
         MealDAO.CadastrarMealApi(meal);
         return(RedirectToAction("Index"));
     }
     ModelState.AddModelError("", "Já existe uma Meal com esse nome");
     return(View(meal));
 }