public ActionResult UploadWrittenReport(int teamId, string oldWrittenReportUrl, HttpPostedFileBase UploadedWrittenReport) { var result = true; var blTeam = new BLTeam(); string writtenReportUrl = string.Empty; try { if (ModelState.IsValid) { writtenReportUrl = UIHelper.UploadFile(UploadedWrittenReport, "/Resources/Uploaded/Teams/WrittenReport/" + CurrentUserId.Replace("-", "")); result = blTeam.UploadWrittenReport(teamId, writtenReportUrl); } } catch (Exception ex) { result = false; } //if (result != false && !string.IsNullOrEmpty(writtenReportUrl)) //{ // UIHelper.DeleteFile(oldWrittenReportUrl); //} var jsonData = new { writtenReportUrl = HttpUtility.HtmlDecode(writtenReportUrl), writtenReportFileName = UploadedWrittenReport.FileName, writtenReportUrlIcon = "/Resources/Images/Mimetypes128x128/" + writtenReportUrl.Split(new string[] { "?CT=" }, StringSplitOptions.RemoveEmptyEntries)[1], success = result, message = "Your written report successfully has been uploaded." }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); //return View("../Author/TeamEdit", model); }