Ejemplo n.º 1
0
        public JsonResult LocationDelete(int LocationId)
        {
            Location_Table locations = db.Location_Table.Find(LocationId);                               // Details of patricular role to be deleted is obtained using it's id

            locations.LocationIsDeleted = true;                                                          //Obtained data record is made inactive by setting value of isdeleted field to one
            db.SaveChanges();
            bool result      = true;
            var  redirectUrl = new UrlHelper(Request.RequestContext).Action("ManageLocation", "Admin");

            return(Json(new { result, Url = redirectUrl }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public JsonResult LocationEdit(int LocationId, string LocationName, int LocationPIN, string LocationDescription)         //updated values are passed as parameters of post function through ajax method
        {
            Location_Table locations = db.Location_Table.Find(LocationId);                                                       //Details of patricular product category to be edited is obtained using it's id

            locations.LocationName        = LocationName;
            locations.LocationPIN         = LocationPIN;
            locations.LocationDesc        = LocationDescription;
            locations.LocationUpdatedBy   = Session["user"].ToString();
            locations.LocationUpdatedDate = DateTime.Now;
            locations.LocationIsDeleted   = false;
            db.SaveChanges();
            var redirectUrl = new UrlHelper(Request.RequestContext).Action("ManageLocation", "Admin");                                                                                                  //passing url to which control to be navigated is stored in a variable

            return(Json(new { LocationId = LocationId, LocationName = LocationName, LocationPIN = LocationPIN, LocationDesc = LocationDescription, Url = redirectUrl }, JsonRequestBehavior.AllowGet)); //Values updated and url is returned back to ajax success function
        }
Ejemplo n.º 3
0
        public ActionResult ManageLocation(Location_Table locations)                                                       //new location is passed as object of  Location_Table to post function ManageLocation
        {
            //if (ModelState.IsValid)

            //{
            locations.LocationCreatedBy   = Session["user"].ToString();
            locations.LocationUpdatedBy   = Session["user"].ToString();
            locations.LocationCreatedDate = DateTime.Now;
            locations.LocationUpdatedDate = DateTime.Now;
            locations.LocationIsDeleted   = false;                                                                     /* Values are added */
            db.Location_Table.Add(locations);                                                                          //Adding values to ProductCategory_Table
            db.SaveChanges();


            return(RedirectToAction("ManageLocation"));
        }
Ejemplo n.º 4
0
        public JsonResult ServiceEdit(int ServiceId, string ServiceName, decimal DeliveryCharge, string ServiceDesc, string LocationName, string ProductName)
        {
            Product_Table  product  = new Product_Table();
            Location_Table location = new Location_Table();
            Service_Table  service  = db.Service_Table.Find(ServiceId);

            service.ServiceName    = ServiceName;
            service.DeliveryCharge = DeliveryCharge;
            service.ServiceDesc    = ServiceDesc;
            int locationId = (from l in db.Location_Table where l.LocationName == LocationName select l.LocationId).FirstOrDefault();

            service.Locationid = locationId;
            int productId = (from p in db.Product_Table where p.ProductName == ProductName select p.ProductId).FirstOrDefault();

            service.Productid          = productId;
            service.ServiceUpdatedBy   = Session["user"].ToString();
            service.ServiceUpdatedDate = System.DateTime.Now;
            db.SaveChanges();
            var redirectUrl = new UrlHelper(Request.RequestContext).Action("Manage_Service", "Service");

            return(Json(new { ServiceId = ServiceId, ServiceName = ServiceName, DeliveryCharge = DeliveryCharge, ServiceDesc = ServiceDesc, LocationName = LocationName, ProductName = ProductName, Url = redirectUrl }, JsonRequestBehavior.AllowGet));
        }