public ActionResult AddTend(TendType tend) { try { _tendService.addTend(tend); var planted = _gardenService.getPlantedCrops(); TendType lastcreated = _tendService.GetLastTendCreated(); foreach (var plant in planted) { Tended myTended = new Tended { cropId = plant.cropId, plantedId = plant.plantedId, tendId = lastcreated.tendId, Date = DateTime.Now }; _tendService.setAsTended(myTended); } return(RedirectToAction("Tends", new { controller = "Tend" })); } catch (Exception ex) { // Might be worth looking at redirection to an error page ViewBag.Exception = ex; return(View()); } }
public void deleteTend(TendType tend) { TendType myTend = getTend(tend.tendId); _context.TendType.Remove(myTend); _context.SaveChanges(); }
public void editTend(TendType tend) { TendType mytend = getTend(tend.tendId); mytend.tendName = tend.tendName; _context.SaveChanges(); }
public ActionResult EditTend(int id, TendType tend) { try { _tendService.editTend(tend); return(RedirectToAction("Tends", new { controller = "Tend" })); } catch (Exception ex) { // Might be worth looking at redirection to an error page ViewBag.Exception = ex; return(View()); } }
public void addTend(TendType tend) { _context.TendType.Add(tend); _context.SaveChanges(); }
public void deleteTend(TendType tend) { _tendDAO.deleteTend(tend); }
public void editTend(TendType tend) { _tendDAO.editTend(tend); }
public void addTend(TendType tend) { _tendDAO.addTend(tend); }