Exemplo n.º 1
0
 public ActionResult DriverDataEdit(DriverModel driverModel)
 {
     if (driverModel.Id == 0)
     {
         TaxiDbContext.ExecuteWithoutReturn(
             "INSERT INTO public.\"Driver\"(\"Name\", \"AutoId\") " +
             "VALUES('" + driverModel.Name + "','" + driverModel.AutoId + "')");
         return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         TaxiDbContext.ExecuteWithoutReturn(
             "UPDATE public.\"Driver\" SET \"Name\" = '" + driverModel.Name +
             "', \"AutoId\" = '" + driverModel.AutoId +
             "' WHERE \"Id\" = " + driverModel.Id + ";");
         return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 2
0
        public ActionResult AutoDataEdit(AutoModel autoModel)
        {
            if (autoModel.AutoId == 0)
            {
                TaxiDbContext.ExecuteWithoutReturn(
                    "INSERT INTO public.\"Auto\"(\"Brand\", \"Model\") " +
                    "VALUES('" + autoModel.Brand + "','" + autoModel.Model + "')");
                return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                TaxiDbContext.ExecuteWithoutReturn(
                    "UPDATE public.\"Auto\" SET \"Brand\" = '" + autoModel.Brand +
                    "', \"Model\" = '" + autoModel.Model +
                    "' WHERE \"AutoId\" = " + autoModel.AutoId + ";");
                return(Json(new { success = true, message = "Update Successfully" }, JsonRequestBehavior.AllowGet));
            }

            //return RedirectToAction("AutoIndex");
        }
Exemplo n.º 3
0
 public ActionResult AutoDataDelete(int id)
 {
     TaxiDbContext.ExecuteWithoutReturn(
         "DELETE FROM public.\"Auto\" WHERE \"AutoId\" = " + id + ";");
     return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
 }