コード例 #1
0
 public ActionResult Edit([Bind(Include = "ChallanNo,IssueDate,LicenceNo,RCNo,totalFine,Paid")] Challan challan)
 {
     if (Request.Cookies.Get("tAdmin") != null)
     {
         string t = Request.Cookies.Get("tAdmin").Value;
         if (t == "Yes")
         {
             if (ModelState.IsValid)
             {
                 db.Entry(challan).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
                 return(RedirectToAction("Index"));
             }
             return(View(challan));
         }
         else
         {
             return(RedirectToAction("Index", "TrafficLogin"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "TrafficLogin"));
     }
 }
コード例 #2
0
        public ActionResult Edit([Bind(Include = "VehicleNo,OwnerName,RegDate,ExpiryDate,Vehicletype,VehicleDescription,RTO,OwnerAddress,ChasisNo,EngineNo,ChallanNo,AadharNo")] RC rC)
        {
            if (Request.Cookies.Get("tAdmin") != null)
            {
                string t = Request.Cookies.Get("tAdmin").Value;
                if (t == "Yes")
                {
                    if (ModelState.IsValid)
                    {
                        rC.OwnerName       = rC.OwnerName.ToUpper();
                        rC.OwnerAddress    = rC.OwnerAddress.ToUpper();
                        db.Entry(rC).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                }
                else
                {
                    return(RedirectToAction("Index", "TrafficLogin"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "TrafficLogin"));
            }

            //  ViewBag.VehicleNo = new SelectList(db.Challans, "ChallanNo", "ChallanNo", rC.VehicleNo);
            //  ViewBag.VehicleNo = new SelectList(db.PUCs, "PUCNo", "PUCNo", rC.VehicleNo);
            return(View(rC));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "RuleId,Rule,Fine")] RULES rULES)
 {
     if (Request.Cookies.Get("tAdmin") != null)
     {
         string t = Request.Cookies.Get("tAdmin").Value;
         if (t == "Yes")
         {
             if (ModelState.IsValid)
             {
                 db.Entry(rULES).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
                 return(RedirectToAction("Index"));
             }
             return(View(rULES));
         }
         else
         {
             return(RedirectToAction("Index", "TrafficLogin"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "TrafficLogin"));
     }
 }
 public ActionResult Edit([Bind(Include = "PublicUserId,UserName,UserEmail,Password,ConfPassword,AadharNo")] PublicUser publicUser)
 {
     if (ModelState.IsValid)
     {
         publicUser.isDLPresent     = false;
         publicUser.isPUCPresent    = false;
         publicUser.isRCPresent     = false;
         db.Entry(publicUser).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(publicUser));
 }
コード例 #5
0
        public ActionResult Edit([Bind(Include = "LicenceNo,OwnerName,profilepic,OwnerAddress,RTO,VehicleDescription,Vehicletype,DOB,IssueDate,ExpiryDate,AadharNo")] DL dL, HttpPostedFileBase profilepicOptional)
        {
            if (Request.Cookies.Get("tAdmin") != null)
            {
                string t = Request.Cookies.Get("tAdmin").Value;
                if (t == "Yes")
                {
                    if (ModelState.IsValid)
                    {
                        if (profilepicOptional != null)
                        {
                            if (profilepicOptional.ContentType == "image/jpg" || profilepicOptional.ContentType == "image/jpeg" || profilepicOptional.ContentType == "image/png")
                            {
                                string ext = System.IO.Path.GetExtension(profilepicOptional.FileName);
                                profilepicOptional.SaveAs(Server.MapPath("/") + "/Content/DrivingLicence/" + dL.LicenceNo + ext);
                                dL.profilepic = dL.LicenceNo + ext;
                            }
                            else
                            {
                                TempData["ErrorMsg"] = "image must be in formate of jpg/png/jpeg only";
                                return(RedirectToAction("Create"));
                            }
                        }

                        dL.OwnerName    = dL.OwnerName.ToUpper();
                        dL.OwnerAddress = dL.OwnerAddress.ToUpper();

                        db.Entry(dL).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }

                    return(View(dL));
                }
                else
                {
                    return(RedirectToAction("Index", "TrafficLogin"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "TrafficLogin"));
            }
        }