Esempio n. 1
0
 public ActionResult Edit(Motorbike motor)
 {
     bool result = MotorBusiness.Update(motor);
     return RedirectToAction("Index");
     //if (result)
     //{
     //}
     //else
     //{
     //    //
     //}
     //return View();
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="moto"></param>
 /// <returns></returns>
 public static bool Insert(Motorbike moto)
 {
     try
     {
         entity.Motorbikes.Add(moto);
         entity.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Esempio n. 3
0
 public ActionResult Create(Motorbike motorbike)
 {
     bool result = false;
     if (ModelState.IsValid)
     {
         result = MotorBusiness.Insert(motorbike);
     }
     //if (result)
     //{
     return RedirectToAction("Index");
     //Should Process more carefully!!!
     //}
     //else
     //{
     //    //raise system message and still here
     //}
     //return View();
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="moto"></param>
 /// <returns></returns>
 public static bool Update(Motorbike moto)
 {
     try
     {
         var currentMoto = entity.Motorbikes.Find(moto.Plate);
         entity.Entry(currentMoto).CurrentValues.SetValues(moto);
         entity.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }