Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,TC,Ad,Soyad,Telefon,eMail,Adres")] Müsteri müsteri)
        {
            if (id != müsteri.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(müsteri);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MüsteriExists(müsteri.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(müsteri));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Plaka,Marka,Model,Yıl,Renk,GünlükÜcret,Cins")] Arac arac)
        {
            if (id != arac.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(arac);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AracExists(arac.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(arac));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,AlışGünü,GeriTeslimGünü,MüsteriID,AracID")] Kiralama kiralama)
        {
            if (id != kiralama.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(kiralama);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KiralamaExists(kiralama.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AracID"]    = new SelectList(_context.Araclar, "ID", "ID", kiralama.AracID);
            ViewData["MüsteriID"] = new SelectList(_context.Müsteriler, "ID", "ID", kiralama.MüsteriID);
            return(View(kiralama));
        }
        public void ReturnProduct(int assetId, int subscriberId)
        {
            var now                = DateTime.Now;
            var subscriber         = GetSubscriber(subscriberId);
            var distributionCenter = GetDistributionCenter(subscriber);
            var inventory          = GetInventory(assetId, distributionCenter.Id);
            var product            = GetRentalAsset(assetId);

            _context.Update(product);

            //remove any existing Rentals on the product
            RemoveExistingRentals(assetId);

            //close any existing checkout history
            CloseExistingRentalHistory(assetId, now);

            //look for existing holds on the item
            //if there are enough holds and enough stock update to the n
            //subscribers with the earliest holds
            var currentHolds = GetCurrentHolds(assetId);

            if (currentHolds.Any())
            {
                RentoutToEarliestHolds(assetId, currentHolds);
                return;
            }

            //otherwise add the item to the distcenter's stock of the asset
            _context.Update(inventory);
            inventory.Stock += 1;

            _context.SaveChanges();
        }
Пример #5
0
 public void UpdateClient(Client client)
 {
     context.Update(client);
 }