Beispiel #1
0
        public async Task <IActionResult> PutMedRecord(int id, MedRecord medRecord)
        {
            if (id != medRecord.id)
            {
                return(BadRequest());
            }

            _context.Entry(medRecord).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MedRecordExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> PutProduct([FromRoute] long id, [FromBody] Product product)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != product.Id)
            {
                return(BadRequest());
            }

            _context.Entry(product).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(id))
                {
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutProductCategory(int id, ProductCategory productCategory)
        {
            if (id != productCategory.CategoryId)
            {
                return(BadRequest());
            }

            _context.Entry(productCategory).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #4
0
        public async Task <IActionResult> PutLabel(int id, Label label)
        {
            if (id != label.LabelId)
            {
                return(BadRequest());
            }

            _context.Entry(label).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LabelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "ID,Name,Description,ItemType,RefID")] Item item)
 {
     if (ModelState.IsValid)
     {
         db.Entry(item).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(item));
 }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "ID,PatientName")] Patient patient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(patient).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(patient));
 }
 public ActionResult Edit([Bind(Include = "DoctorID,EmployeeId")] Doctor doctor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeeId = new SelectList(db.Employees, "EmployeeId", "EmployeeId", doctor.EmployeeId);
     return(View(doctor));
 }
Beispiel #8
0
        public async Task <IActionResult> PutOrder(int id, Order order)
        {
            if (id != order.OrderId)
            {
                return(BadRequest());
            }

            _context.Entry(order).State = EntityState.Modified;
            bool isItemsUpdated = false;

            foreach (var item in order.Items)
            {
                _context.Entry(item).State = EntityState.Modified;
                isItemsUpdated             = true;
            }

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderExists(id))
                {
                    return(NotFound());
                }
                else if (isItemsUpdated)
                {
                    return(NoContent());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #9
0
        public ActionResult Edit([Bind(Include = "InventoryId,ItemId,Amount,DispType,Brand,PharmacyId")] Inventory inventory)
        {
            var manager     = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));
            var currentUser = manager.FindById(User.Identity.GetUserId());

            inventory.PharmacyId = currentUser.Pharmacist.PharmacyId;

            if (ModelState.IsValid)
            {
                db.Entry(inventory).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ItemId     = new SelectList(db.items, "ItemId", "Name", inventory.ItemId);
            ViewBag.PharmacyId = new SelectList(db.Pharmacies, "PharmacyId", "Name", inventory.PharmacyId);
            return(View(inventory));
        }
Beispiel #10
0
 public void UpdatePatient(Patient patient)
 {
     context.Entry(patient).State = EntityState.Modified;
 }
Beispiel #11
0
 public void UpdatePrescription(Prescription prescription)
 {
     context.Entry(prescription).State = EntityState.Modified;
 }
Beispiel #12
0
 public void UpdateManufacturer(Manufacturer manufacturer)
 {
     context.Entry(manufacturer).State = EntityState.Modified;
 }
Beispiel #13
0
 public void UpdateDoctor(Doctor doctor)
 {
     context.Entry(doctor).State = EntityState.Modified;
 }
Beispiel #14
0
 public void UpdateDrug(Drug drug)
 {
     context.Entry(drug).State = EntityState.Modified;
 }
Beispiel #15
0
 public void UpdateOrganization(Organization organization)
 {
     context.Entry(organization).State = EntityState.Modified;
 }
Beispiel #16
0
 public void UpdateUser(User user)
 {
     context.Entry(user).State = EntityState.Modified;
 }
Beispiel #17
0
 public void UpdateOrder(Order order)
 {
     context.Entry(order).State = EntityState.Modified;
 }