Пример #1
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Warehouse).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WarehouseExists(Warehouse.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            _context.User.Add(User);
            await _context.SaveChangesAsync();

            return(RedirectToPage("../Login"));
        }
Пример #3
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Position.Add(Position);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Пример #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Car = await _context.Car.FindAsync(id);

            if (Car != null)
            {
                _context.Car.Remove(Car);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Пример #5
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Employee = await _context.Employee.FindAsync(id);

            if (Employee != null)
            {
                _context.Employee.Remove(Employee);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Пример #6
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Position = await _context.Position.FindAsync(id);

            if (Position != null)
            {
                _context.Position.Remove(Position);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Пример #7
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            LoTrinh = await _context.LoTrinh.FindAsync(id);

            if (LoTrinh != null)
            {
                _context.LoTrinh.Remove(LoTrinh);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Пример #8
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            VeMayBay = await _context.VeMayBay.FindAsync(id);

            if (VeMayBay != null)
            {
                _context.VeMayBay.Remove(VeMayBay);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            user = await _context.User.FirstOrDefaultAsync(o => o.id == HttpContext.Session.GetInt32("user_id"));


            _context.Address.Add(Address);
            Company.Address = Address;
            _context.Company.Add(Company);
            user.Company = Company;
            await _context.SaveChangesAsync();

            return(RedirectToPage("../User/UserPage", new { id = user.id }));
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TaskItem = await _context.TaskItem.FindAsync(id);

            if (TaskItem != null)
            {
                _context.TaskItem.Remove(TaskItem);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("/"));
        }
Пример #11
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            KhachHang = await _context.KhachHang.FindAsync(id);

            if (KhachHang != null)
            {
                _context.KhachHang.Remove(KhachHang);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Пример #12
0
        public async Task <IActionResult> OnPostAsync(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            PhieuDatVe = await _context.PhieuDatVe.FindAsync(id);

            if (PhieuDatVe != null)
            {
                _context.PhieuDatVe.Remove(PhieuDatVe);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Пример #13
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Emp.Add(Emp);
            await _context.SaveChangesAsync();


            // ResetMyObj();

            /*Emp.Id = 0;
             * Emp.Name = "Type Your Name Here...";*/
            // return RedirectToPage("./Index");
            return(Page());
        }
Пример #14
0
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            Company Company = await _context.Company.Include(o => o.Resturaunts).FirstOrDefaultAsync(r => r.id == HttpContext.Session.GetInt32("company_id"));

            ResturauntPage resturauntPage = new ResturauntPage();

            resturauntPage.Days = new List <Day>();
            resturauntPage.Days.Add(new Day()
            {
                DayName = "Monday"
            });
            resturauntPage.Days.Add(new Day()
            {
                DayName = "Tuesday"
            });
            resturauntPage.Days.Add(new Day()
            {
                DayName = "Wednesday"
            });
            resturauntPage.Days.Add(new Day()
            {
                DayName = "Thursday"
            });
            resturauntPage.Days.Add(new Day()
            {
                DayName = "Friday"
            });
            resturauntPage.Days.Add(new Day()
            {
                DayName = "Saturday"
            });
            resturauntPage.Days.Add(new Day()
            {
                DayName = "Sunday"
            });
            resturauntPage.Image = new Image();

            Resturaunt.ResturauntPage = resturauntPage;

            String    Address  = Resturaunt.Address.AddressLine1 + " " + Resturaunt.Address.AddressLine2 + " " + Resturaunt.Address.City + " " + Resturaunt.Address.State + " " + Resturaunt.Address.Country + " " + Resturaunt.Address.Zip;
            IGeocoder geocoder = new Geocoding.Microsoft.BingMapsGeocoder("AqxoCm4UJW5_DXYlq73P9Vso_jGJl60qBQSZnt6VhtCv9wZSK2SbSAKq_ljydb6S");
            IEnumerable <Geocoding.Address> addresses = await geocoder.GeocodeAsync(Address);

            Models.Location location = new Models.Location();
            location.Lang = addresses.First().Coordinates.Latitude;
            location.Long = addresses.First().Coordinates.Longitude;


            Resturaunt.Location = location;

            Company.Resturaunts.Add(Resturaunt);
            _context.Resturaunt.Add(Resturaunt);
            location.ResturauntId = Resturaunt.id;
            _context.Location.Add(location);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }