public ActionResult Report(FormCollection form) { if (Session["LogedUserID"] != null) { try { var datefrom = Request.Form["datefrom"].ToString(); var dateto = Request.Form["dateto"].ToString(); string fromdateString = datefrom.Trim(); string todateString = dateto.Trim(); string format = "dd/MM/yyyy"; CultureInfo provider = CultureInfo.InvariantCulture; DateTime fd = DateTime.ParseExact(fromdateString, format, provider); DateTime td = DateTime.ParseExact(todateString, format, provider); var doc = db.SP_DoctorReport(fd, td); return(View(doc)); } catch (Exception ex) { return(View()); } } else { return(RedirectToAction("AdminLogin", "Account")); } }