SaveInfo() public method

public SaveInfo ( string Address, string Email, string phone, string Footer, string imageName ) : void
Address string
Email string
phone string
Footer string
imageName string
return void
Example #1
0
        public ActionResult SiteInfo(InfoSite info, HttpPostedFileBase image_banner)
        {
            if (ModelState.IsValid)
            {
                ChangeInfoSite ch = new ChangeInfoSite();
                if (image_banner != null && image_banner.ContentLength > 0)
                {
                    string pic = System.IO.Path.GetFileName(image_banner.FileName);
                    string path = System.IO.Path.Combine(Server.MapPath("~/Content/image"), pic);
                    if (System.IO.File.Exists(path))
                    {
                        int count = 2;
                        while (System.IO.File.Exists(path))
                        {
                            pic = count.ToString() + pic;
                            path = System.IO.Path.Combine(Server.MapPath("~/Content/image"), pic);
                        }
                    }
                    image_banner.SaveAs(path);
                    info.imageName = pic;
                    //ch.SaveInfo(info.Address, info.Email, info.Phone, info.Footer, info.imageName);
                }
                ch.SaveInfo(info.Address, info.Email, info.Phone, info.Footer, info.imageName);

                return RedirectToAction("Contact", "Home");
            }
            return View(info);
        }