Exemple #1
0
        public virtual ActionResult Edit(Transporter transporter)
        {
            if (_transporterService.IsNameValid(transporter.TransporterID, transporter.Name))
            {
                ModelState.AddModelError("Name", "Transporter Name should be Unique");
            }
            if (ModelState.IsValid)
            {
                _transporterService.EditTransporter(transporter);
                return(Json(new { sucess = true }));
            }
            return(PartialView(transporter));



            //if(!repository.Transporter.IsNameValid(transporter.TransporterID,transporter.Name))
            //{
            //    ModelState.AddModelError("Name","Transporter Name should be Unique");
            //}
            //if (ModelState.IsValid)
            //{
            //    repository.Transporter.SaveChanges(transporter);
            //    return Json(new { success = true });
            //}
            //return View(transporter);
        }
 public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, Transporter transporter)
 {
     transportService.EditTransporter(transporter);
     return(Json(ModelState.ToDataSourceResult(), JsonRequestBehavior.AllowGet));
 }