예제 #1
0
 public ActionResult CreateEdit(TypeBusViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (TypeBusDataAccess.Update(model))
             {
                 return(Json(new { success = true, message = "Success" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 return(Json(new { success = false, message = TypeBusDataAccess.Message }, JsonRequestBehavior.AllowGet));
             }
         }
         else
         {
             return(Json(new { success = false, message = "Lengkapi isi form nya" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult Create()
 {
     ViewBag.KaroseriList = new SelectList(KaroseriDataAccess.GetAll(), "KaroseriId", "Description");
     ViewBag.MerkBusList  = new SelectList(MerkBusDataAccess.GetAll(), "MerkId", "Description");
     ViewBag.TypeBusList  = new SelectList(TypeBusDataAccess.GetByMerkBus(""), "TypeId", "Description");
     return(View());
 }
        public ActionResult Edit(int id)
        {
            FleetViewModel model = FleetDataAccess.GetById(id);

            ViewBag.KaroseriList = new SelectList(KaroseriDataAccess.GetAll(), "KaroseriId", "Description");
            ViewBag.MerkBusList  = new SelectList(MerkBusDataAccess.GetAll(), "MerkId", "Description");
            ViewBag.TypeBusList  = new SelectList(TypeBusDataAccess.GetByMerkBus(model.MerkId), "TypeId", "Description");
            return(View(model));
        }
예제 #4
0
 public ActionResult DeleteConfirm(int id)
 {
     if (TypeBusDataAccess.Delete(id))
     {
         return(Json(new { success = true, message = "Success" }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new { success = false, message = TypeBusDataAccess.Message }, JsonRequestBehavior.AllowGet));
     }
     return(Json(new { success = false, message = "Error :p" }, JsonRequestBehavior.AllowGet));
 }
예제 #5
0
 public ActionResult Delete(int id)
 {
     return(View(TypeBusDataAccess.GetById(id)));
 }
예제 #6
0
 public ActionResult Edit(int id)
 {
     ViewBag.MerkBusList = new SelectList(MerkBusDataAccess.GetAll(), "MerkId", "Description");
     return(View(TypeBusDataAccess.GetById(id)));
 }
예제 #7
0
        public ActionResult GetByMerkId(string merkid)
        {
            List <TypeBusViewModel> model = TypeBusDataAccess.GetByMerkBus(merkid);

            return(View(model));
        }
예제 #8
0
        public ActionResult List()
        {
            List <TypeBusViewModel> model = TypeBusDataAccess.GetAll();

            return(View(model));
        }