public ActionResult Upload(HomeworkModel model, string returnUrl, string topic_id)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     try
     {
         System.Diagnostics.Debug.WriteLine(model.TopicId);
         System.Diagnostics.Debug.WriteLine(model.Author);
         if (model.UploadFile.ContentLength > 0)
         {
             string fileName = Path.GetFileName(model.UploadFile.FileName);
             string path     = Path.Combine(Server.MapPath("~/Static/Homework/"), topic_id + "_" + User.Identity.GetUserName() + "_" + fileName);
             model.UploadFile.SaveAs(path);
         }
         ViewBag.Message = "File Uploaded Successfully!!";
         var database = new HomeworkDataBase();
         database.accessDataBase();
         database.insertHomwork(model, User.Identity.GetUserName(), topic_id, topic_id + "_" + User.Identity.GetUserName() + "_" + Path.GetFileName(model.UploadFile.FileName));
         return(RedirectToAction("Index", "Topic"));
     }
     catch
     {
         ViewBag.Message = "File upload failed!!";
         return(View());
     }
 }