Beispiel #1
0
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         type.RecipeId = recipe.id;
         try
         {
             typeMain = _typesService.GetByName(typeName);
         }
         catch (InvalidOperationException)
         {
             _typesService.Add(new TypeDTO {
                 Name = typeName
             });
             typeMain = _typesService.GetByName(typeName);
         }
         type.TypeId = typeMain.id;
         _service.Add(type);
         return(Redirect(Url.Page("/Recipe_ingredient", new { id = recipe.id, login = user.Login })));
     }
     return(Page());
 }