예제 #1
0
        public async Task <IActionResult> Edit(Guid id, Site site)
        {
            if (id != site.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(site);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SiteExists(site.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "CompanyName", site.CompanyId);
            return(View(site));
        }
예제 #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("SiteId,ContractId,ScheduledDateTime,EstimatedDurationMins,ActualDurationMins,EstimatedAppliances,ActualAppliances,TestSlowResult,Id,Created,Modified")] TestSlot testSlot)
        {
            if (id != testSlot.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(testSlot);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestSlotExists(testSlot.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractId"] = new SelectList(_context.Contracts, "Id", "Id", testSlot.ContractId);
            ViewData["SiteId"]     = new SelectList(_context.Sites, "Id", "Id", testSlot.SiteId);
            return(View(testSlot));
        }
예제 #3
0
        public async Task <IActionResult> Edit(Guid id, Contact contact)
        {
            if (id != contact.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contact);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContactExists(contact.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", "Companies", new { id = contact.CompanyId }));
            }
            ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "CompanyName", contact.CompanyId);
            return(View(contact));
        }
예제 #4
0
        public async Task <IActionResult> Edit(Guid id, [Bind("IntervalMonths,CompanyId,SiteId,StartDate,RenewalDate,CancelledDate,Id,Created,Modified")] Contract contract)
        {
            if (id != contract.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contract);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractExists(contract.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "CompanyName", contract.CompanyId);
            ViewData["SiteId"]    = new SelectList(_context.Sites, "Id", "Id", contract.SiteId);
            return(View(contract));
        }
예제 #5
0
        public async Task <IActionResult> Edit(Guid id, [Bind("CompanyName,Id,Created,Modified")] Company company)
        {
            if (id != company.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(company);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }