Пример #1
0
        public ActionResult UploadLogo(LogoUploadVM vm)
        {
            var fn = vm.Logo.FileName;
            var length = fn.Length;

            if (vm.Logo != null && vm.Logo.ContentLength > 0 && fn.Substring(length-4) == ".png")
                try
                {
                    var path = Path.Combine(Server.MapPath("~/Uploads"), "Logo.png");
                    vm.Logo.SaveAs(path);
                    //_logoManager.SetLogo(vm.Logo.FileName);
                    ViewBag.Message = "File Uploaded Successfully";
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "Error: " + ex.Message;
                }
            else
            {
                ViewBag.Message = "You have not specified a valid file.";
            }

            vm = new LogoUploadVM();
            return View(vm);
        }
Пример #2
0
 public ActionResult UploadLogo()
 {
     var vm = new LogoUploadVM();
     return View(vm);
 }