Пример #1
0
 public void Edit(Recipe recipe)
 {
     var toRemove = _recipes.Where(x => x.Id == recipe.Id).FirstOrDefault();
     if (toRemove != null)
         _recipes.Remove(toRemove);
     _recipes.Add(recipe);
 }
Пример #2
0
        public void Edit(Recipe recipe)
        {
            var tableClient = GetClient();

            CloudTable table = tableClient.GetTableReference(TABLE_NAME);

            var toInsert = AutoMapper.Mapper.Map<Recipe, RecipeTableEntity>(recipe);
            TableOperation insertOrReplaceOperation = TableOperation.InsertOrReplace(toInsert);

            table.Execute(insertOrReplaceOperation);
        }
Пример #3
0
        public ActionResult Create(Recipe recipe, HttpPostedFileBase imageLocation)
        {
            if (ModelState.IsValid)
            {
                recipe.Id = Guid.NewGuid();
                if (imageLocation != null)
                    recipe.ImageLocation = ImageRepository.Save(imageLocation.ContentType, imageLocation.InputStream).AbsoluteUri;

                RecipeRepository.Create(recipe);
                SearchProvider.AddToIndex(recipe);

                return RedirectToAction("Index");
            }

            return View(recipe);
        }
Пример #4
0
 public ActionResult Edit(Recipe recipe)
 {
     if (ModelState.IsValid)
     {
         RecipeRepository.Edit(recipe);
         return RedirectToAction("Index");
     }
     return View(recipe);
 }
Пример #5
0
 public bool AddToIndex(Recipe recipe)
 {
     var client = GetClient();
     var response = client.Index(recipe);
     return response.Created;
 }
Пример #6
0
 public void Create(Recipe recipe)
 {
     recipe.Id = Guid.NewGuid();
     _recipes.Add(recipe);
 }
Пример #7
0
 public void Edit(Recipe recipe)
 {
 }
Пример #8
0
 public void Create(Recipe recipe)
 {
 }