Exemplo n.º 1
0
        public ActionResult Guncelle(int orderID, string?error)
        {
            if (error != null && error != "")
            {
                ModelState.AddModelError("error", error);
            }
            OrderModel order = _context.OrderModel.Include(b => b.orderdetailsmodels)
                               .FirstOrDefault <OrderModel>(t => t.orderID == orderID && t.validTo == DateTime.Parse("2099-01-01"));

            SiparisModel siparis = new SiparisModel();

            siparis.orderID               = order.orderID;
            siparis.orderDate             = order.orderDate;
            siparis.orderLocationID       = order.orderLocationID;
            siparis.orderOwner_personelID = order.personelID;
            siparis.recStatus             = order.recStatus;
            ViewData["personelID"]        = new SelectList(_context.employeesmodels, nameof(SiparisModel.orderOwnerEmployeeModel.personelID), nameof(SiparisModel.orderOwnerEmployeeModel.persName));
            EmployeesModels employees = _context.employeesmodels.FirstOrDefault(t => t.personelID == siparis.orderOwner_personelID);

            siparis.orderLocation = _context.stocklocationmodel.FirstOrDefault(e => e.locationID == siparis.orderLocationID);
            foreach (OrderDetailsModel orderDetails in order.orderdetailsmodels)
            {
                orderDetails.Product = _context.Products.FirstOrDefault(e => e.productBarcodeID == orderDetails.productBarcodeID);
            }
            siparis.orderdetailsmodels = order.orderdetailsmodels;
            siparis.operation          = "Update";
            return(View("Giris", siparis));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("personelID,persName,persSurName,password,locationID,userName,connectionId,userRole,userActive,accessFailedCount,recStatus")] EmployeesModels employeesmodels)
        {
            if (id != employeesmodels.personelID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeesmodels);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!employeesmodelsExists(employeesmodels.personelID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["locationID"] = new SelectList(_context.stocklocationmodel, nameof(stocklocationmodel.locationID), nameof(stocklocationmodel.locationName));
            return(View(employeesmodels));
        }
Exemplo n.º 3
0
        public ActionResult Giris(string productName)
        {
            SiparisModel siparis = new SiparisModel();

            if (User.Identity.IsAuthenticated)
            {
                siparis.orderDate      = DateTime.Now;
                ViewData["personelID"] = new SelectList(_context.employeesmodels, nameof(SiparisModel.orderOwnerEmployeeModel.personelID), nameof(SiparisModel.orderOwnerEmployeeModel.persName));
                EmployeesModels employees = _context.employeesmodels.First();
                siparis.orderLocation = _context.stocklocationmodel.FirstOrDefault(e => e.locationID == employees.locationID);
                if (!String.IsNullOrEmpty(productName))
                {
                    siparis.Products = _context.Products.Where(x => x.productName.Contains(productName)).ToList();
                }
                else
                {
                    siparis.Products = new List <products>();
                }
                siparis.operation = "Add";
            }
            else
            {
                ModelState.AddModelError("User", "İşlem yapabilmeniz için sisteme giriş yapınız.");
            }
            return(View(siparis));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("personelID,persName,persSurName,password,locationID,userName,connectionId,userRole,userActive,accessFailedCount,recStatus")] EmployeesModels employeesmodels)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeesmodels);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["locationID"] = new SelectList(_context.stocklocationmodel, nameof(stocklocationmodel.locationID), nameof(stocklocationmodel.locationName));
            return(View(employeesmodels));
        }