Beispiel #1
0
        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);
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 // PUT api/values/5
 public void Put([FromBody] CreatePizza createPizza)
 {
 }