Пример #1
0
        /// <summary>
        /// Edit Tipo Novedad
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Edit(BeCausaHerida item)
        {
            try
            {
                using (var db = new EstG2Contex())
                {
                    var ch = new CausaHerida();


                    ch.UsuarioActualizo = "gbrito";
                    ch.FechaActualizo   = DateTime.Now;
                    ch.Nombre           = item.Nombre;
                    ch.CausaHeridaID    = item.ID;
                    ch.EstatusID        = (int)item.EstatusID;
                    db.CausaHerida.Attach(ch);
                    db.Entry(ch).Property(x => x.Nombre).IsModified           = true;
                    db.Entry(ch).Property(x => x.EstatusID).IsModified        = true;
                    db.Entry(ch).Property(x => x.UsuarioActualizo).IsModified = true;
                    db.Entry(ch).Property(x => x.FechaActualizo).IsModified   = true;
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// Create Tipo Novedad
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool Create(BeCausaHerida item)
 {
     try
     {
         return(_dalc.Create(item));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #3
0
 public ActionResult Edit(BeCausaHerida item)
 {
     if (item == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     try
     {
         BcCausaHerida.Edit(item);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #4
0
 public ActionResult Create(BeCausaHerida item)
 {
     if (item == null)
     {
         AllEstados();
         return(View(item));
     }
     try
     {
         BcCausaHerida.Create(item);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #5
0
        /// <summary>
        /// Create Tipo Causa Herida
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool Create(BeCausaHerida item)
        {
            try
            {
                using (var db = new EstG2Contex())
                {
                    var tn = new CausaHerida();
                    tn.Nombre      = item.Nombre;
                    tn.EstatusID   = (int)item.EstatusID;
                    tn.UsuarioCreo = "gbrito";
                    tn.FechaCreo   = DateTime.Now;
                    db.CausaHerida.Add(tn);
                    db.SaveChanges();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw new Exception(ex.Message);
            }
        }