コード例 #1
0
 //Agregar
 public IHttpActionResult Agregar(BE.Denuncia denuncia)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     DAL.CRUDDenuncia oCRUDDenuncia = new DAL.CRUDDenuncia();
     try
     {
         oCRUDDenuncia.Agregar(denuncia);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(Ok(denuncia));
 }
コード例 #2
0
        //Funcion agregar
        public bool Agregar(BE.Denuncia pDenuncia)
        {
            bool         ret;
            ITransaction transaction = session.BeginTransaction();

            try
            {
                session.Save(pDenuncia);
                transaction.Commit();
                ret = true;
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                throw ex;
            }

            return(ret);
        }