Example #1
0
        public ActionResult AssignDriver(AddVehicle model)
        {
            DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();

            try
            {
                DSRCManagementSystem.DriverVehicle_Mapping obj = new DSRCManagementSystem.DriverVehicle_Mapping();

                obj.VehicleId   = db.Vehicles.Where(x => x.Vehicle_No == model.Vehicle_No).Select(x => x.VehicleId).FirstOrDefault();
                obj.DriverId    = Convert.ToInt32(model.DriverName);
                obj.Co_DriverId = Convert.ToInt32(model.Co_DriverName);
                db.AddToDriverVehicle_Mapping(obj);
                db.SaveChanges();
            }
            catch (Exception Ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
            }
            return(Json("Success1", JsonRequestBehavior.AllowGet));
        }