Beispiel #1
0
        public ActionResult Create(CreateFormModel createFormModel)
        {
            RequestResult requestResult = new RequestResult();

            try
            {
                var model = Session["OrganizationCreateFormModel"] as CreateFormModel;

                model.FormInput = createFormModel.FormInput;

                requestResult = OrganizationDataAccessor.Create(model);

                if (requestResult.IsSuccess)
                {
                    HttpRuntime.Cache.Remove("Organizations");

                    Session.Remove("OrganizationFormAction");
                    Session.Remove("OrganizationCreateFormModel");
                    var account = Session["Account"] as Account;
                    account.OrganizationPermissions = OrganizationDataAccessor.GetOrganizationPermissions(account.OrganizationId);
                    Session["Account"] = account;
                }
            }
            catch (Exception e)
            {
                var error = new Error(MethodBase.GetCurrentMethod(), e);
                Logger.Log(error);
                requestResult.ReturnError(error);
                //throw;
            }

            return(Content(JsonConvert.SerializeObject(requestResult)));
        }