public void CanCompareWebSamples() { WebSample instance = new WebSample(); EntityIdSetter.SetIdOf<int>(instance, 1); WebSample instanceToCompareTo = new WebSample(); EntityIdSetter.SetIdOf<int>(instanceToCompareTo, 1); instance.ShouldEqual(instanceToCompareTo); }
public ActionResult Create(WebSample WebSample) { if (ViewData.ModelState.IsValid && WebSample.IsValid()) { WebSampleRepository.SaveOrUpdate(WebSample); TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] = "The WebSample was successfully created."; return RedirectToAction("Index"); } WebSampleFormViewModel viewModel = WebSampleFormViewModel.CreateWebSampleFormViewModel(); viewModel.WebSample = WebSample; return View(viewModel); }
private void TransferFormValuesTo(WebSample WebSampleToUpdate, WebSample WebSampleFromForm) { // __BEGIN__PROPERTY__ WebSampleToUpdate.Property = WebSampleFromForm.Property; // __END__PROPERTY__ }
public ActionResult Edit(WebSample WebSample) { WebSample WebSampleToUpdate = WebSampleRepository.Get(WebSample.Id); TransferFormValuesTo(WebSampleToUpdate, WebSample); if (ViewData.ModelState.IsValid && WebSample.IsValid()) { TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] = "The WebSample was successfully updated."; return RedirectToAction("Index"); } else { WebSampleRepository.DbContext.RollbackTransaction(); WebSampleFormViewModel viewModel = WebSampleFormViewModel.CreateWebSampleFormViewModel(); viewModel.WebSample = WebSample; return View(viewModel); } }