public async Task <ActionResult> ManageContactDetails(ManageContactDetailsViewModel model) { await SetBreadcrumb(model.SchemeId, InternalUserActivity.ManageScheme); if (!ModelState.IsValid) { using (var client = apiClient()) { model.OrganisationAddress.Countries = await client.SendAsync(User.GetAccessToken(), new GetCountries(false)); } return(View(model)); } using (var client = apiClient()) { var orgData = new SchemeData() { OrganisationId = model.OrgId, Contact = model.Contact, Address = model.OrganisationAddress, }; await client.SendAsync(User.GetAccessToken(), new UpdateSchemeContactDetails(orgData)); } return(RedirectToAction("Overview", new { schemeId = model.SchemeId, overviewDisplayOption = OverviewDisplayOption.ContactDetails })); }
public async Task <ActionResult> ManageContactDetails(Guid schemeId, Guid orgId) { await SetBreadcrumb(schemeId, InternalUserActivity.ManageScheme); var model = new ManageContactDetailsViewModel(); using (var client = apiClient()) { var scheme = await client.SendAsync(User.GetAccessToken(), new GetSchemeById(schemeId)); if (!scheme.CanEdit) { return(new HttpForbiddenResult()); } var countries = await client.SendAsync(User.GetAccessToken(), new GetCountries(false)); model.OrganisationAddress = scheme.Address; model.Contact = scheme.Contact; model.OrganisationAddress.Countries = countries; model.SchemeId = schemeId; model.OrgId = orgId; } return(View(model)); }
public async Task<ActionResult> ManageContactDetails(ManageContactDetailsViewModel model) { await SetBreadcrumb(model.SchemeId); if (!ModelState.IsValid) { using (var client = apiClient()) { model.OrganisationAddress.Countries = await client.SendAsync(User.GetAccessToken(), new GetCountries(false)); } return View(model); } using (var client = apiClient()) { var orgData = new OrganisationData { Id = model.OrgId, Contact = model.Contact, OrganisationAddress = model.OrganisationAddress, }; await client.SendAsync(User.GetAccessToken(), new UpdateOrganisationContactDetails(orgData)); } return RedirectToAction("Overview", new { schemeId = model.SchemeId, overviewDisplayOption = OverviewDisplayOption.ContactDetails }); }
public async Task<ActionResult> ManageContactDetails(Guid schemeId, Guid orgId) { await SetBreadcrumb(schemeId); var model = new ManageContactDetailsViewModel(); using (var client = apiClient()) { var scheme = await client.SendAsync(User.GetAccessToken(), new GetSchemeById(schemeId)); if (!scheme.CanEdit) { return new HttpForbiddenResult(); } var organisationData = await client.SendAsync(User.GetAccessToken(), new GetOrganisationInfo(orgId)); var countries = await client.SendAsync(User.GetAccessToken(), new GetCountries(false)); model.OrganisationAddress = organisationData.OrganisationAddress; model.Contact = organisationData.Contact; model.OrganisationAddress.Countries = countries; model.SchemeId = schemeId; model.OrgId = orgId; } return View(model); }