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

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contractor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContractorExists(contractor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contractor));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Type,DeviceId")] Sign sign)
        {
            if (id != sign.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sign);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SignExists(sign.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sign));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Lat,Lng,Img,Rating")] CameraInfo cameraInfo)
        {
            if (id != cameraInfo.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cameraInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CameraInfoExists(cameraInfo.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cameraInfo));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ContractorId")] Work work)
        {
            if (id != work.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(work);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkExists(work.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "Id", "Name", work.ContractorId);
            return(View(work));
        }