public void Post([FromBody] UploadRequestViewModel model) { MemoryStream file = new MemoryStream(); CopyStream(model.File.InputStream, file); var createPizza = new CreatePizza() { Name = model.Name, Ingredients = model.Ingredients, File = file.ToArray(), MIMEType = model.File.ContentType }; _logger.Write(createPizza); }
public void Write(CreatePizza createPizza) { List <Ingredient> ingredients = new List <Ingredient>(); foreach (var IdIngredient in createPizza.Ingredients) { ingredients.Add(_repository.FindIngredient(IdIngredient)); } var pizza = new Pizza() { Id = Guid.NewGuid(), Name = createPizza.Name, Ingredients = ingredients, File = createPizza.File, MIMEType = createPizza.MIMEType }; _repository.Write(pizza); _unitOfWork.SaveChanges(); }
// PUT api/values/5 public void Put([FromBody] CreatePizza createPizza) { }