Exemple #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ForwarderExists(Forwarder.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync(int?forwarder)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Contact.ForwarderId            = forwarder ?? default(int);
            _context.Attach(Contact).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ContactExists(Contact.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("../Details", new { id = forwarder }));
        }
Exemple #3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync(int?forwarder)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            Contact.ForwarderId = forwarder ?? default(int);

            _context.ForwarderContact.Add(Contact);
            await _context.SaveChangesAsync();

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

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

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

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync(int?id, int?address)
        {
            if (id == null)
            {
                return(NotFound());
            }
            AddressId = address ?? default(int);
            Contact   = await _context.AddressContact.FindAsync(id);

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

            return(RedirectToPage("../Details", new { id = address }));
        }
Exemple #7
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync(int?id, int?forwarder)
        {
            if (id == null)
            {
                return(NotFound());
            }
            ForwarderId = forwarder ?? default(int);
            Contact     = await _context.ForwarderContact.FindAsync(id);

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

            return(RedirectToPage("../Details", new { id = forwarder }));
        }
Exemple #9
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Exemple #10
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Order.Forwarder = await _context.Forwarder.Where(e => e.Id == ForwarderId).FirstOrDefaultAsync();

            Order.Receiver = await _context.Address.Where(e => e.Id == ReceiverId).FirstOrDefaultAsync();

            Order.Sender = await _context.Address.Where(e => e.Id == SenderId).FirstOrDefaultAsync();

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

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