Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address")] Manufacturer manufacturer)
        {
            if (id != manufacturer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(manufacturer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ManufacturerExists(manufacturer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(manufacturer));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Address,DoctorForeignKey")] Organization organization)
        {
            if (id != organization.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organization);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganizationExists(organization.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorForeignKey"] = new SelectList(_context.Doctor, "Id", "Id", organization.DoctorForeignKey);
            return(View(organization));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Firstname,Lastname,DoctorId")] Patient patient)
        {
            if (id != patient.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(patient);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatientExists(patient.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorId"] = new SelectList(_context.Doctor, "Id", "Id", patient.DoctorId);
            return(View(patient));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Firstname,Lastname,Certificate")] Doctor doctor)
        {
            if (id != doctor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(doctor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DoctorExists(doctor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(doctor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ProdusID,NumeMedicament,CategorieID,FurnizorID,Doza,Pret,DataExpirare")] Produs produs)
        {
            if (id != produs.ProdusID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(produs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProdusExists(produs.ProdusID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategorieID"] = new SelectList(_context.Categorii, "CategorieID", "CategorieID", produs.CategorieID);
            ViewData["FurnizorID"]  = new SelectList(_context.Furnizori, "FurnizorID", "FurnizorID", produs.FurnizorID);
            return(View(produs));
        }
Example #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,StartTime,EndTime")] Order order)
        {
            if (id != order.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Description")] Category category)
        {
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_context.CategoryExists(category.Id))
                    {
                        return(NotFound());
                    }

                    throw;
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(category));
        }
Example #8
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Cnpj,Address,PostCode,Phone,Email")]
                                               Supplier supplier)
        {
            if (id != supplier.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supplier);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_context.SupplierExists(supplier.Id))
                    {
                        return(NotFound());
                    }

                    throw;
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(supplier));
        }
Example #9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Dosage,Price,Name,Type,Description")] Drug drug)
        {
            if (id != drug.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(drug);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DrugExists(drug.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(drug));
        }
        public async Task <IActionResult> Edit(long id,
                                               [Bind("Id,Name,Description,Price,Batch,Type,SupplierId")]
                                               Product product)
        {
            if (id != product.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_context.ProductExists(product.Id))
                    {
                        return(NotFound());
                    }

                    throw;
                }

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["SupplierId"] =
                new SelectList(_context.Suppliers, "Id", "Name", product.SupplierId);
            return(View(product));
        }
 public void Update(Pharmacy pharmacy)
 {
     context.Update(pharmacy);
 }