/*
         * // POST: Patient/Delete/5
         * [System.Web.Http.HttpPost]
         * public ActionResult Delete(int id, FormCollection collection)
         * {
         *  try
         *  {
         *      bool deleted = _document.DeletePatient(id);
         *      return RedirectToAction("Index");
         *  }
         *  catch (Exception ex)
         *  {
         *
         *      throw;
         *  }
         * }
         */

        // GET: Patient/GetCollection
        public ActionResult PatientList()
        {
            try
            {
                List <Patient>       col   = _document.GetPatientCollection();
                PatientListViewModel model = new PatientListViewModel();
                model.PatientCollection = col;
                return(View("PatientList", model));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "User type is invalid !" + Environment.NewLine + ex.Message;
                return(RedirectToAction("Index", "Home"));
            }
        }
 public HttpResponseMessage GetPatientsCollection()
 {
     try
     {
         List <Patient> col = _document.GetPatientCollection();
         if (col != null && col.Count > 0)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, col));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.BadRequest, CommonUnit.oFailed));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }