Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,OfficeName")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
        public async Task <IActionResult> Create([Bind("Id,Name")] ProductType productType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productType));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Dec")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(doctor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,RightEyeParam_1,RightEyeParam_2,RightEyeParam_3,LeftEyeParam_1,LeftEyeParam_2,LeftEyeParam_3,DesesaseId")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patient);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DesesaseId"] = new SelectList(_context.Desesase, "Id", "Id", patient.DesesaseId);
            return(View(patient));
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,CurrentStoreValue,ProductCategoryId,ProductTypeId")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductCategoryId"] = new SelectList(_context.ProductCategorys, "Id", "Name", product.ProductCategoryId);
            ViewData["ProductTypeId"]     = new SelectList(_context.ProductTypes, "Id", "Name", product.ProductTypeId);
            return(View(product));
        }
Exemple #6
0
        public async Task <IActionResult> Create([Bind("Id,EntryDate,NameOfSupplier,AddressOfSupplier,ProductId,DescriptionOfProduct,NumberOfSuppliedProduct,SuppliedProductUnitPrice")] Entry entry)
        {
            if (ModelState.IsValid)
            {
                Product product = _context.Products.SingleOrDefault(p => p.Id == entry.ProductId);
                entry.InitialCount         = product.CurrentStoreValue;
                product.CurrentStoreValue += entry.NumberOfSuppliedProduct;
                _context.Products.Update(product);
                _context.Entries.Add(entry);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", entry.ProductId);
            return(View(entry));
        }
        public async Task <IActionResult> Create([Bind("Id,ReceiveDate,NameOfUser,AddressOfUser,DemandNoteNo,ProductId,NumberOfReceivedProduct,TotalNoOfProductAfterdeduction,EntryId")] Exit exit)
        {
            if (ModelState.IsValid)
            {
                Product product = _context.Products.SingleOrDefault(p => p.Id == exit.ProductId);
                if (product.CurrentStoreValue >= exit.NumberOfReceivedProduct)
                {
                    product.CurrentStoreValue -= exit.NumberOfReceivedProduct;
                    _context.Products.Update(product);
                    exit.TotalNoOfProductAfterdeduction = product.CurrentStoreValue;
                    _context.Exits.Add(exit);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            ViewData["EntryId"]   = new SelectList(_context.Entries, "Id", "AddressOfSupplier", exit.EntryId);
            ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", exit.ProductId);
            return(View(exit));
        }