Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("locationId,fLocation,tLocation,fDate,tDate,streetNo,streetAddress,city,stateabre,state,country")] tbllocation tbllocation)
        {
            if (id != tbllocation.locationId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Update(tbllocation);
                    await db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!tbllocationExists(tbllocation.locationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbllocation));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("locationId,fLocation,tLocation,fDate,tDate,streetNo,streetAddress,city,stateabre,state,country")] tbllocation tbllocation)
        {
            if (ModelState.IsValid)
            {
                db.Add(tbllocation);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tbllocation));
        }
Exemplo n.º 3
0
        public IActionResult Reservation_Create(ReservationNew Vm)
        {
            var cars = new tblCars
            {
                catId      = Vm.category.catId,
                Car        = Vm.car.Car,
                color      = Vm.car.Color,
                Model_No   = Vm.car.Model,
                Brand_Name = Vm.car.Brand
            };
            var cus = new tblCustomer
            {
                First_Name = Vm.customer.FirstName,
                Last_Name  = Vm.customer.LastName,
                Email      = Vm.customer.EmailAddress,
                CNIC       = Vm.customer.CNIC,
                mobileno   = Vm.customer.MobileNo,
                state      = Vm.customer.State,
            };

            var loc = new tbllocation
            {
                fLocation     = Vm.location.fromLocation,
                tLocation     = Vm.location.toLocation,
                fDate         = Vm.location.fromDate,
                tDate         = Vm.location.toDate,
                state         = Vm.location.Stateloc,
                country       = Vm.location.Countryloc,
                streetNo      = Vm.location.StreetNo,
                streetAddress = Vm.location.Address,
                city          = Vm.location.City
            };


            db.tblCars.Add(cars);
            db.tblCustomer.Add(cus);
            db.tbllocation.Add(loc);

            db.SaveChanges();

            return(View());
        }
Exemplo n.º 4
0
 public ActionResult addlocation(tbllocation location)
 {
     dblocation.tbllocations.Add(location);
     dblocation.SaveChanges();
     return(View());
 }
Exemplo n.º 5
0
 public ActionResult editlocation(tbllocation data)
 {
     dblocation.Entry(data).State = EntityState.Modified;
     dblocation.SaveChanges();
     return(View(data));
 }