예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("id_pat,codigo,descripcion,activo")] Patologias patologias)
        {
            if (id != patologias.id_pat)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(patologias);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PatologiasExists(patologias.id_pat))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(patologias));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("id_pat,codigo,descripcion,activo")] Patologias patologias)
        {
            if (ModelState.IsValid)
            {
                _context.Add(patologias);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(patologias));
        }
예제 #3
0
        public ActionResult AddSurgery_Or_Trauma(int category, string name, string date, string observations)
        {
            Patologias p = new Patologias();

            p.Nombre        = name;
            p.Categoria     = category;
            p.idpaciente    = idPatient;
            p.Fecha         = date;
            p.Observaciones = observations;
            DB.Patologias.Add(p);
            DB.SaveChanges();

            return(Json(p, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public ActionResult Remove(int idPatologia)
        {
            Patologias p = (from patho in DB.Patologias
                            where patho.idpaciente == idPatient && patho.idpatologia == idPatologia
                            select patho).First();
            bool resp = false;

            try
            {
                DB.Patologias.Remove(p);
                DB.SaveChanges();
                resp = true;
            }
            catch {  }
            return(Json(new { status = resp.ToString().ToLower() }, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public ActionResult AddDiseases_Or_Others(int category,
                                                  string name, string alergeno, int age, string manejo, string evolution)
        {
            Patologias p = new Patologias();

            p.idpaciente    = idPatient;
            p.Nombre        = name;
            p.Manejo        = manejo;
            p.Categoria     = category;
            p.Evoluciones   = evolution;
            p.EdadAdquirida = age;
            p.Alergeno      = alergeno;
            DB.Patologias.Add(p);
            DB.SaveChanges();

            return(Json(p, JsonRequestBehavior.AllowGet));
        }