public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Created_at,Updated_at")] Block block) { if (id != block.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(block); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlockExists(block.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(block)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,NameResponsible,Email,Address,Phone,CityId,Created_at,Updated_at")] Client client) { if (id != client.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", client.CityId); return(View(client)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ClientId,Description,UserId,Created_at,Updated_at")] Survey survey) { if (id != survey.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(survey); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SurveyExists(survey.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ClientId"] = new SelectList(_context.Client, "Id", "Id", survey.ClientId); ViewData["UserId"] = new SelectList(_context.User, "Id", "Email", survey.UserId); return(View(survey)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,UF,Created_at,Updated_at")] State state) { if (id != state.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(state); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StateExists(state.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(state)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Description,TypeEquipament,Status,Created_at,Updated_at")] Equipament equipament) { if (id != equipament.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(equipament); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EquipamentExists(equipament.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(equipament)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email,Address,UserId,CityId,Created_at,Updated_at")] Employee employee) { if (id != employee.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", employee.CityId); ViewData["UserId"] = new SelectList(_context.User, "Id", "Email", employee.UserId); return(View(employee)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email,Username,Password,Created_at,Updated_at")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,StateId,Created_at,Updated_at")] City city) { if (id != city.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(city); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CityExists(city.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StateId"] = new SelectList(_context.State, "Id", "Name", city.StateId); return(View(city)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,SurveyId,BlockId,FlooringId,EquipamentId")] SurveyResources surveyResources) { if (id != surveyResources.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(surveyResources); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SurveyResourcesExists(surveyResources.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BlockId"] = new SelectList(_context.Block, "Id", "Id", surveyResources.BlockId); ViewData["EquipamentId"] = new SelectList(_context.Equipament, "Id", "Id", surveyResources.EquipamentId); ViewData["FlooringId"] = new SelectList(_context.Flooring, "Id", "Id", surveyResources.FlooringId); ViewData["SurveyId"] = new SelectList(_context.Survey, "Id", "Id", surveyResources.SurveyId); return(View(surveyResources)); }