Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            var p = new ClienteApiProcess();

            Cliente cliente = p.ReadBy(id);

            p.Delete(cliente);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit(Cliente cliente)
 {
     if (ModelState.IsValid)
     {
         var p = new ClienteApiProcess();
         p.Update(cliente);
         return(RedirectToAction("Index"));
     }
     return(View(cliente));
 }
Esempio n. 3
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var     p       = new ClienteApiProcess();
            Cliente cliente = p.ReadBy(id.Value);

            if (cliente == null)
            {
                return(HttpNotFound());
            }
            return(View(cliente));
        }
Esempio n. 4
0
        public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page)
        {
            var p     = new ClienteApiProcess();
            var lista = p.ToList();

            ViewBag.CurrentSort = sortOrder;

            ViewBag.NameSortParm = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;

            var cliente = from s in lista select s;

            if (!string.IsNullOrEmpty(searchString))
            {
                cliente = cliente.Where(s => s.Apellido.Contains(searchString));
            }


            switch (sortOrder)
            {
            case "name_desc":
                cliente = cliente.OrderByDescending(s => s.Apellido);
                break;

            default:
                cliente = cliente.OrderBy(s => s.Apellido);
                break;
            }

            int pageSize   = 5;
            int pageNumber = (page ?? 1);

            return(View(cliente.ToPagedList(pageNumber, pageSize)));


            //return View(db.ToList());
        }
Esempio n. 5
0
        public ActionResult AgregarMascota(int id)
        {
            var obj = new Paciente();

            var db    = new ClienteApiProcess();
            var dueño = db.ReadBy(id);

            obj.Cliente   = dueño;
            obj.ClienteId = dueño.Id;


            EspecieApiProcess eap = new EspecieApiProcess();

            var especies     = eap.ToList();
            var listEspecies = new SelectList(especies, "Id", "Nombre");

            ViewData["Especies"] = listEspecies;


            return(View(obj));
        }
Esempio n. 6
0
 public ActionResult Create(Cliente cliente)
 {
     try
     {
         var p = new ClienteApiProcess();
         p.Add(cliente);
         TempData["MessageViewBagName"] = new GenericMessageViewModel
         {
             Message     = "Registro agregado a la base de datos.",
             MessageType = GenericMessages.success
         };
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         TempData["MessageViewBagName"] = new GenericMessageViewModel
         {
             Message         = ex.Message,
             MessageType     = GenericMessages.danger,
             ConstantMessage = true
         };
     }
     return(View(cliente));
 }
        public JsonResult GetEvents(DateTime start, DateTime end)
        {
            //var viewModel = new CitaViewModel();
            var events = new List <object>();

            var citas = new CitaApiProcess().ToList();

            foreach (var c in citas)
            {
                var paciente = new PacienteApiProcess().ReadBy(c.PacienteId);
                var cliente  = new ClienteApiProcess().ReadBy(paciente.ClienteId);

                events.Add(new CitaViewModel()
                {
                    id    = c.Id,
                    title = cliente.Apellido.ToString(),
                    start = c.Fecha.AddDays(1).AddHours(-5).ToString("yyyy-MM-dd hh:mm "),
                    //end = c.Fecha.AddHours(-5).AddMinutes(30).ToString("yyyy-MM-dd hh:mm"),
                    allDay = false
                });
            }

            return(Json(events.ToArray(), JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public ActionResult Index()
        {
            var p = new ClienteApiProcess();

            return(View(p.ToList()));
        }