public async Task <IActionResult> Edit(int id, [Bind("Id,Name,About,Phone,Email")] Institute institute) { if (id != institute.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _iInstituteManager.Update(institute); } catch (DbUpdateConcurrencyException) { if (!InstituteExists(institute.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(institute)); }
public IActionResult Edit(long id, Institute institute) { if (id != institute.Id) { return(NotFound()); } if (ModelState.IsValid) { try { institute.UpdatedAt = DateTime.Now; _iInstituteManager.Update(institute); } catch (DbUpdateConcurrencyException) { if (!InstituteExists(institute.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(institute)); }
public void Update() { UnityResolver.Register(); IInstituteManager InstituteManager = UnityResolver.Resolve <IInstituteManager>(); Common.Models.Institute institute = InstituteManager.FindById(91); institute.InstituteName = "IJSEPanadura" + DateTime.Now.ToString(); bool isUpdate = InstituteManager.Update(institute); InstituteManager.Save(); Common.Models.Institute institute1 = InstituteManager.FindById(93); string expected = "IJSEPanadura"; string actual = institute1.InstituteName; Assert.AreEqual(expected, actual); }