public ActionResult AddVersion([Bind(Include = "FileID, VerNo, Name, RelativeDirectory")] FileVersionViewModel vm) { try { var file = Request.Files["file"] as HttpPostedFileBase; if (file != null && file.ContentLength != 0) { UserStorageService.InsertFileVersion(vm, file); return(RedirectToAction("Single", new { id = vm.FileID })); } else { throw new Exception("Please fill all fields"); } } catch (Exception ex) { return(RedirectToAction("Index", "Response", new { Message = ex.Message, Code = 400, Type = "Error" })); } }