public static PlantDetail BuildDTO(PlantDomain.Plant thisPlant) { return(new DTObjects.PlantDetail { Sku = thisPlant.SKU, Name = thisPlant.Name, FormSize = thisPlant.FormSize, Price = thisPlant.Price }); }
public ActionResult Edit(PlantDomain.Plant plant) { if (ModelState.IsValid) { repository.UpdatePlant(plant); repository.Save(); return(RedirectToAction("Index")); } return(View(plant)); }
// GET: Stocks/Edit/5 public ActionResult Edit(string sku) { if (sku == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PlantDomain.Plant plant = repository.GetPlantBySku(sku); if (plant == null) { return(HttpNotFound()); } return(View(plant)); }
public ActionResult Create(PlantDomain.Plant plant) { if (ModelState.IsValid) { if (repository.AddPlant(plant)) { repository.Save(); } return(RedirectToAction("Index")); } return(View(plant)); }