Example #1
0
 public ActionResult AddOrEdit(_Distributor distributor)
 {
     if (distributor.DistributorId == 0)
     {
         if (distributorService.Add(distributor))
         {
             return(Json(new { success = true, message = "Add successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = "Failed to add" }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         if (distributorService.Edit(distributor))
         {
             return(Json(new { success = true, message = "Edit successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = "Failed to edit" }, JsonRequestBehavior.AllowGet));
         }
     }
 }