public void Edit(Recipe recipe) { var toRemove = _recipes.Where(x => x.Id == recipe.Id).FirstOrDefault(); if (toRemove != null) _recipes.Remove(toRemove); _recipes.Add(recipe); }
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); }
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); }
public ActionResult Edit(Recipe recipe) { if (ModelState.IsValid) { RecipeRepository.Edit(recipe); return RedirectToAction("Index"); } return View(recipe); }
public bool AddToIndex(Recipe recipe) { var client = GetClient(); var response = client.Index(recipe); return response.Created; }
public void Create(Recipe recipe) { recipe.Id = Guid.NewGuid(); _recipes.Add(recipe); }
public void Edit(Recipe recipe) { }
public void Create(Recipe recipe) { }