Esempio n. 1
0
 // GET: Patient/Create
 public ActionResult Create()
 {
     try
     {
         var clients = clientBusiness.List();
         ViewBag.ClientId = new SelectList(clients, "Id", "Name");
         return(View());
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message, ex);
         return(View());
     }
 }
        public ActionResult Create([Bind(Include = "Id,Name,ClientId,Gender,ImagePath")] Patient patient, HttpPostedFileBase file)
        {
            if (ModelState.IsValid && patient.Name != null && patient.Gender != 0)
            {
                var patientBll = new PatientBLL();

                if (file != null && file.ContentLength > 0)
                {
                    string filename = Path.GetFileName(file.FileName);
                    string imgpath  = Path.Combine(Server.MapPath("~/Content/PatientImages/"), filename);
                    file.SaveAs(imgpath);
                    patient.ImgPath = "~/Content/PatientImages/" + file.FileName;
                }
                else
                {
                    patient.ImgPath = "~/Content/PatientImages/default.jpg";
                }

                patientBll.Insert(patient);
                return(RedirectToAction("Index"));
            }
            var clientBll = new ClientBLL();

            ViewBag.ClientId = new SelectList(clientBll.List(), "Id", "FullName", patient.ClientId);
            return(View(patient));
        }
        // GET: Patients/Create
        public ActionResult Create()
        {
            var clientBll = new ClientBLL();

            ViewBag.ClientId = new SelectList(clientBll.List(), "Id", "FullName");
            return(View());
        }
Esempio n. 4
0
 // GET: Client
 public ActionResult Index()
 {
     try
     {
         var clients = clientBusiness.List();
         return(View(ClientModel.ToModelList(clients)));
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message, ex);
         ModelState.AddModelError("Model", "Ha ocurrido un error. Por favor, contacte al administrador");
         return(View());
     }
 }
        // GET: Patients/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var     patientBll = new PatientBLL();
            Patient patient    = patientBll.GetById(id);

            if (patient == null)
            {
                return(HttpNotFound());
            }
            var clientBll = new ClientBLL();

            ViewBag.ClientId = new SelectList(clientBll.List(), "Id", "FullName", patient.ClientId);
            return(View(patient));
        }
 // GET: Clients
 public ActionResult Index()
 {
     return(View(clientBLL.List()));
 }