public ActionResult Upload(ProfileViewModel model) { var image = WebImage.GetImageFromRequest(); if (image != null) { var filename = Path.GetFileName(image.FileName); var name = image.FileName; image.Save(Path.Combine(HttpContext.Server.MapPath("/Images"), filename)); filename = Path.Combine(HttpContext.Server.MapPath("/Images"), filename); model.ImageUrl = Url.Content(filename); model.ImageUrl = name; var editModel = new EditorInputModel() { Profile = model, Width = image.Width, Height = image.Height, Top = image.Height * 0.1, Left = image.Width * 0.9, Right = image.Width * 0.9, Bottom = image.Height * 0.9 }; return View("Edit", editModel); } return View("Index", model); }
public ActionResult UploadImage(ProfileViewModel model, string ImageName) { var image = WebImage.GetImageFromRequest(); if (image != null) { var filename = ImageName + ".png"; image.Save(Path.Combine(HttpContext.Server.MapPath("/Images/Temp"), filename)); model.ImageUrl = filename; var editModel = new EditorInputModel() { Profile = model, Width = image.Width, Height = image.Height, Top = image.Height * 0.1, Left = image.Width * 0.9, Right = image.Width * 0.9, Bottom = image.Height * 0.9 }; return View("EditImage", editModel); } return View("Index", model); }
public ActionResult Index(ProfileViewModel model) { return View(model); }