Ejemplo n.º 1
0
        public ActionResult OrganisationDetails([Bind(Include = "AppUserId,SelectedOrganisationId,OrganisationName,BusinessType,AddressLine1,AddressLine2,AddressLine3,AddressTownCity,AddressCounty,AddressPostcode,TelephoneNumber,Email,Website,ContactName,CompanyRegistrationDetails,CharityRegistrationDetails,VATRegistrationDetails,ListingPrivacyLevel,PrivacyLevel,GroupPrivacyLevel")] HomeOrganisationDetailsView model)
        {
            if (Request.Form["resetbutton"] != null)
            {
                return(RedirectToAction("OrganisationDetails", "Home"));
            }

            if (ModelState.IsValid)
            {
                //If the 'Submit' button pressed then update tables, else leave as are so that on reload it takes original values once again.
                if (Request.Form["submitbutton"] != null)
                {
                    if (model.SelectedOrganisationId == null)
                    {
                        //Add organisation update appUser with this organisationId
                        Organisation organisation = OrganisationHelpers.CreateOrganisation(model, User);
                        AppUserHelpers.UpdateAppUserOrganisationId(User, organisation.OrganisationId);
                        AppUserHelpers.UpdateAppUserRoleAndEntityStatus(User, UserRoleEnum.Admin, EntityStatusEnum.Active, User);
                        ApplicationUser user = UserHelpers.UpdateUserRole(User, UserRoleEnum.Admin);
                    }
                    else
                    {
                        AppUserHelpers.UpdateAppUserOrganisationId(User, model.SelectedOrganisationId.Value);
                        AppUserHelpers.UpdateAppUserRoleAndEntityStatus(User, UserRoleEnum.User, EntityStatusEnum.OnHold, User);
                    }

                    return(RedirectToAction("Index", "Home"));
                }
            }

            //DropDown - rebuild and clear selected option
            ViewBag.OrganisationList     = ControlHelpers.AllOrganisationsListDropDown();
            model.SelectedOrganisationId = null;
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult OrganisationAdmin([Bind(Include = "OrganisationId,OrganisationName,BusinessType,AddressLine1,AddressLine2,AddressLine3,AddressTownCity,AddressCounty,AddressPostcode,TelephoneNumber,Email,Website,ContactName,CompanyRegistrationDetails,CharityRegistrationDetails,VATRegistrationDetails,ListingPrivacyLevel,PrivacyLevel,GroupPrivacyLevel")] OrganisationAdminView model)
        {
            if (Request.Form["resetbutton"] != null)
            {
                return(RedirectToAction("OrganisationAdmin"));
            }

            if (ModelState.IsValid)
            {
                OrganisationHelpers.UpdateOrganisation(db, model, User);
                return(RedirectToAction("Dashboard", "Home"));
            }
            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult GetOrganisationDetailsForOrganisation(Guid organisationId)
        {
            if (organisationId != null)
            {
                Organisation organisationDetails = OrganisationHelpers.GetOrganisation(organisationId);

                if (organisationDetails != null)
                {
                    string businessTypeText = EnumHelpers.GetDescription(organisationDetails.BusinessType);
                    return(Json(new { organisationDetails, businessTypeText, success = true }));
                }
                return(Json(new { success = false }));
            }
            return(Json(new { success = false }));
        }