Exemple #1
0
        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());
            }
        }
Exemple #2
0
        public void deleteTend(TendType tend)
        {
            TendType myTend = getTend(tend.tendId);

            _context.TendType.Remove(myTend);

            _context.SaveChanges();
        }
Exemple #3
0
        public void editTend(TendType tend)
        {
            TendType mytend = getTend(tend.tendId);

            mytend.tendName = tend.tendName;

            _context.SaveChanges();
        }
Exemple #4
0
        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());
            }
        }
Exemple #5
0
 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);
 }