public ActionResult Upload(HttpPostedFileBase file, ResultModel model) { var AsNumCheck = DBBridge.CheckAssignmentNum(model.AssignmentId); if (AsNumCheck.Count == 0) { ViewBag.Message = "There is no Assignment Id which you typed."; return(View()); } if (file != null && file.ContentLength > 0) { if (!file.FileName.Contains(".cs")) { ViewBag.Message = "The file extension is not .cs."; return(View()); } var path = Path.Combine("C:\\Users\\deniz\\source\\repos\\GradProj\\Metrics\\", "Assignment.cs"); file.SaveAs(path); } else { ViewBag.Message = "The file is empty!"; return(View()); } return(RedirectToAction("UploadResult", new { AssignmentId = model.AssignmentId })); }