public ActionResult DeleteConfirmed(int id)
        {
            FarmersTraining farmersTraining = db.FarmersTrainings.Find(id);

            db.FarmersTrainings.Remove(farmersTraining);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "TrainingId,TrainerName,EventName,Description,TrainingTime")] FarmersTraining farmersTraining)
 {
     if (ModelState.IsValid)
     {
         db.Entry(farmersTraining).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(farmersTraining));
 }
        public ActionResult Create([Bind(Include = "TrainingId,TrainerName,EventName,Description,TrainingTime")] FarmersTraining farmersTraining)
        {
            if (ModelState.IsValid)
            {
                db.FarmersTrainings.Add(farmersTraining);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(farmersTraining));
        }
        // GET: FarmersTrainings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FarmersTraining farmersTraining = db.FarmersTrainings.Find(id);

            if (farmersTraining == null)
            {
                return(HttpNotFound());
            }
            return(View(farmersTraining));
        }