Exemplo n.º 1
0
 public async Task <IActionResult> Edit(int id, [Bind("FlagID,Comments,IsActive,MedicalDeviceID,Name,Problem,Warehouse,ReviewedBy,DateSubmitted,DateReviewed")] Flag flag)
 {
     if (id != flag.FlagID)
     {
         return(NotFound());
     }
     flag.DateReviewed = DateTime.UtcNow;
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(flag);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!FlagExists(flag.FlagID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index"));
     }
     ViewData["MedicalDeviceID"] = new SelectList(_context.MedicalDevices, "ID", "ID", flag.MedicalDeviceID);
     return(View(flag));
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("BinID,BinNumber,InUse,Name")] Bin bin)
        {
            if (id != bin.BinID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BinExists(bin.BinID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(bin));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Barcode,BinID,Brand,CreatedBy,Description,IsApproved,Manufacturer,PhotoUrl,Name,Warehouse,DateSubmitted")] MedicalDevice medicalDevice)
        {
            if (id != medicalDevice.ID)
            {
                return(NotFound());
            }

            MedicalDevice tempmd = GetMedicalDeviceById(id);

            if (ModelState.IsValid)
            {
                medicalDevice.CreatedBy = User.Identity.Name;
                medicalDevice.Name      = "";
                medicalDevice.Warehouse = "";
                AddLog(tempmd, medicalDevice);
                try
                {
                    _context.Update(medicalDevice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MedicalDeviceExists(medicalDevice.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            PopulateBinsDropDownList(medicalDevice.BinID);
            return(View(medicalDevice));
        }