public ActionResult Edit(Motorbike motor) { bool result = MotorBusiness.Update(motor); return RedirectToAction("Index"); //if (result) //{ //} //else //{ // // //} //return View(); }
/// <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; } }
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(); }
/// <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; } }