Example #1
0
        public ActionResult CreateOrganization(CreateOrganization organization, HttpPostedFileBase LogoImage)
        {
            //Models.Organization newOrganization;
            try
            {
                string logoName = WsConstant.randomString() + Path.GetExtension(LogoImage.FileName).ToLower();
                string path     = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Content/Upload"), logoName);
                LogoImage.SaveAs(path);
                organization.LogoUrl = "/Content/Upload/" + logoName;

                using (var db = new OrganizationDAL())
                {
                    db.AddNewOrganization(organization, User.Identity.Name);
                }
            }
            catch (Exception)
            {
                return(Redirect("/#/Error"));
            }

            return(Redirect("/#/Home"));
        }