Exemplo n.º 1
0
        public ActionResult Add(Image imageModel)
        {
            string fileName  = Path.GetFileNameWithoutExtension(imageModel.ImageFile.FileName);
            string extension = Path.GetExtension(imageModel.ImageFile.FileName);

            fileName             = fileName + DateTime.Now.ToString("yymmssfff") + extension;
            imageModel.ImagePath = "~/images/" + fileName;
            fileName             = Path.Combine(Server.MapPath("~/images/"), fileName);
            ImageServices service = new ImageServices();

            service.SaveImage(imageModel, fileName);
            ModelState.Clear();
            return(RedirectToAction("GetUserPage", "Users", new { imageModel.Page }));
        }