public int Post(LoadRecipeRequest request) { try { RecipeDataAccess _dataAccess = new RecipeDataAccess(); _dataAccess.Insert(request); //Retorna 204: La peticion ha sido manejada con exito y la respuesta no tiene contenido return(204); } catch (Exception ex) { Console.WriteLine("RecipeModel.Post : ERROR : " + ex.Message); //Error interno del servidor return(500); } }
public void Insert(LoadRecipeRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); RecipesEntity recipe = new RecipesEntity() { Path = request.Path }; context.RecipesEntity.Add(recipe); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("RecipeDataAccess.Insert : ERROR : " + ex.Message); throw; } }