Exemplo n.º 1
0
        // POST api/Entidad
        //[ResponseType(typeof(TEntity))]
        public virtual IHttpActionResult Post(TEntity obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //db.obj.Add(obj);
            //db.SaveChanges();
            objDb.Add(obj);

            return(CreatedAtRoute("DefaultApi", new { id = this.GetPkValue(obj) }, obj));
        }
Exemplo n.º 2
0
        private void CreateLogEventos(string Evento, RUsuario Usuario)
        {
            try
            {
                using (BusinessBase <LTLogEventos> objLTLogEventos = new BusinessBase <LTLogEventos>())
                {
                    string       UserLogin    = HelperGeneral.GetSession();
                    int?         IdUsuarioMod = string.IsNullOrEmpty(UserLogin) ? null : (int?)this.objDb.Get(o => o.Usuario == UserLogin).FirstOrDefault().IdUsuario;
                    LTLogEventos NewLog       = new LTLogEventos();
                    NewLog.FechaEvento = DateTime.Now;
                    NewLog.Evento      = Evento;
                    NewLog.IdUsuario   = Usuario.IdUsuario;
                    NewLog.idUserMod   = IdUsuarioMod;
                    objLTLogEventos.Add(NewLog);
                }
            }

            catch (Exception ex)
            {
                HelperGeneral.exceptionError(ex);
            }
        }