public void Update(Agency agency) { agency.Name = OrganisationName; agency.UserName = UserName; agency.Password = Password; agency.Email = Email; }
private Agency GetAgency(SignupViewModel viewModel) { var agency = new Agency(); viewModel.Update(agency); agencyService.CreateNewAgency(agency); viewModel.UpdateSuburbs(agency.MetaProduct); return agency; }
public void Update(Agency agency) { agency.Name = Name; agency.UserName = UserName; agency.Password = Password; agency.Email = Email; agency.Role = RoleNames.agency; }
private void SaveAgency(Agency agency) { saver.AddToContext(agency); saver.SaveAll(); agencyService.UpdateAgencyIds(agency); saver.SaveAll(); agencyService.CreateNewAgencyFileSystemObjects(agency); SetSuccessMessage("New Agency created successfully."); }
private bool ValidateAgency(Agency agency) { if (!agency.IsValid) { SetModelErrors(agency, "Save failed."); return false; } if (agencyService.IsExistingUsername(agency.UserName)) { ModelState.AddModelError("UserName", "Invalid username. Please try another."); SetModelErrors(agency, "Save failed."); return false; } return true; }
public ActionResult CreateNewAgency(NewAgencyViewModel model, FormCollection form) { if (!ModelState.IsValid) return ViewNewAgencyForm(model,"Save failed."); var agency = new Agency(); model.Update(agency); agencyService.CreateNewAgency(agency); if (!agency.IsValid) return ViewNewAgencyForm(model, "Save failed.", agency); saver.AddToContext(agency); saver.SaveAll(); agencyService.UpdateAgencyIds(agency); saver.SaveAll(); agencyService.CreateNewAgencyFileSystemObjects(agency); SetSuccessMessage("Saved."); return RedirectToAction("Menu"); }
public void CreateNewAgency_setup() { agencyRepoMock = new Mock<IAgencyRepository>(); context = new Mock<ICanAddToContext>(); agency = new Agency { Name = "Test Name", UserName = "******", Password = "******", Email = "test", Role = RoleNames.agency }; fileSystem = new Mock<IFileSystemService>(); fileSystem.Expect(f => f.CreateDirectory(It.IsAny<string>())).Verifiable(); fileSystem.Expect(f => f.CreateDirectory(It.IsAny<string>())).Verifiable(); fileSystem.Expect(f => f.CopyFile(It.IsAny<string>(), It.IsAny<string>())).Verifiable(); agencyService = new AgencyService(agencyRepoMock.Object, context.Object, fileSystem.Object); }
/// <summary> Creates the meta product (including meta attributes)</summary> public void CreateNewAgency(Agency agency) { var metaProduct = MetaProduct.GetDefaultMetaProduct(); context.AddToContext(metaProduct); metaProduct.MetaAttributes.ToList().ForEach(ma => context.AddToContext(ma)); agency.SetMetaProduct(metaProduct); }
public void UpdateAgencyIds(Agency agency) { agency.AgencyId = agency.Id; agency.MetaProduct.AgencyId = agency.Id; agency.MetaProduct.MetaAttributes.ToList().ForEach(ma => ma.AgencyId = agency.Id); }
public void Setup() { hostAgency = new AgencyBuilder().WithRole(RoleNames.host).WithName("Host Agency").Build(); ViewMapper.ConfigureAutomapper(); }
public void UpdateAgency(Agency agency) { agency.Name = Name; agency.Password = Password; agency.Email = Email; }
public ProfileViewModel(Agency agency) { Name = agency.Name; UserName = agency.UserName; Password = agency.Password; RetypePassword = agency.Password; Email = agency.Email; LogoRelative = agency.LogoRelative; }
partial void UpdateAgency(Agency instance);
private ViewResult ViewNewAgencyForm(NewAgencyViewModel model, string errorMessage, Agency agency) { SetModelErrors(agency); return ViewNewAgencyForm(model, errorMessage); }
partial void DeleteAgency(Agency instance);
public void CreateNewAgencyFileSystemObjects(Agency agency) { fileSystem.CreateDirectory(agency.ContentDirectory); fileSystem.CreateDirectory(agency.TemplateDirectory); fileSystem.CopyFile(AppDomain.CurrentDomain.BaseDirectory + "\\Content\\Message.vm", Path.Combine(agency.TemplateDirectory, "Message.vm")); }
private bool SaveLogo(Agency agency) { HttpPostedFileBase newLogo = Request.Files["newLogo"]; if (newLogo == null || newLogo.ContentLength == 0) return true; if (!newLogo.IsImageFileType()) { SetErrorMessage("Invalid logo file type. Valid types are: .jpg, .jpeg, .gif and .png."); return false; } newLogo.SaveAs(Server.MapPath(agency.ContentDirectoryRelative + newLogo.FileName)); agency.LogoFileName = newLogo.FileName; return true; }
partial void InsertAgency(Agency instance);