public List<Paciente> Get( Paciente entity)
        {
            List<Paciente> ret = new List<Paciente>();

            //Add data access
            ret = CreateMockData();
            //Context _ctx = new Context();
            //IEnumerable<Paciente> pacientes = _ctx.Pacientes.ToArray();

            if (!string.IsNullOrEmpty(entity.Nome))
            {
                ret = ret.FindAll(p => p.Nome.ToLower().StartsWith(entity.Nome, StringComparison.CurrentCultureIgnoreCase));
            }

            return ret;
        }
        public ActionResult Index(Paciente paciente)
        {
            /*List<KeyValuePair<string, string>> errors = new List<KeyValuePair<string, string>>();
            errors.Add(new KeyValuePair<string, string>("Nome", "Esse paciente já foi cadastrado"));

            ModelState.AddModelError(errors[0].Key, errors[0].Value);
            */
            if (ModelState.IsValid)
            {
                try
                {
                    _ctx.Pacientes.Add(paciente);
                    _ctx.SaveChanges();

                }
                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                }
                return RedirectToAction("Index", "ListaPacientes");
            }
            return View();
        }
 private void ResetSearch()
 {
     SearchEntity = new Paciente();
 }
 public PacienteViewModel()
 {
     Pacientes = new List<Paciente>();
     EventCommand = "List";
     SearchEntity = new Paciente();
 }