コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Expected_date_of_delivery,ParcelsId")] Trackings trackings)
        {
            if (id != trackings.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trackings);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrackingsExists(trackings.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ParcelsId"] = new SelectList(_context.Set <Parcels>(), "Id", "Content_type", trackings.ParcelsId);
            return(View(trackings));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email_Id,Address,Mobile_Number")] Recievers recievers)
        {
            if (id != recievers.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(recievers);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RecieversExists(recievers.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(recievers));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Delivery_address,Parcel_weight,Content_type,Shipping_cost,SendersId,CompaniesId,RecieversId")] Parcels parcels)
        {
            if (id != parcels.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(parcels);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ParcelsExists(parcels.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompaniesId"] = new SelectList(_context.Companies, "Id", "Email_Id", parcels.CompaniesId);
            ViewData["RecieversId"] = new SelectList(_context.Recievers, "Id", "Email_Id", parcels.RecieversId);
            ViewData["SendersId"]   = new SelectList(_context.Senders, "Id", "Email_Id", parcels.SendersId);
            return(View(parcels));
        }