コード例 #1
0
 public IHttpActionResult Save(BlogTagModel item)
 {
     try
     {
         if (item != null)
         {
             BlogTagService.SaveOrUpdate(item);
             return(Ok(item));
         }
         return(BadRequest("No se ha enviado información que almacenar."));
     }
     catch (HibernateAdoException hibernateException)
     {
         if (hibernateException.InnerException is GenericADOException)
         {
             if (hibernateException.InnerException.InnerException is OracleException)
             {
                 return(InternalServerError(hibernateException.InnerException.InnerException));
             }
             return(InternalServerError(hibernateException.InnerException));
         }
         return(InternalServerError(hibernateException));
     }
     catch (Exception exception)
     {
         return(InternalServerError(exception));
     }
 }
コード例 #2
0
        public int SaveOrUpdate(BlogTagModel entity)
        {
            if (entity.ID != 0)
            {
                var dbEntity = BlogTagRepository.Get(entity.ID);
                if (dbEntity != null)
                {
                    BlogTagRepository.Update(dbEntity);

                    return(dbEntity.ID);
                }
                throw new ArgumentException("Invalid id");
            }
            return(BlogTagRepository.Save(entity));
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 public void Update(BlogTagModel entity)
 {
     CurrentSession.Update(entity);
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Save(BlogTagModel entity)
 {
     return((int)CurrentSession.Save(entity));
 }
コード例 #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entity"></param>
 public void Update(BlogTagModel entity)
 {
     CurrentSession.Update(entity);
 }
コード例 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Save(BlogTagModel entity)
 {
     return (int) CurrentSession.Save(entity);
 }
コード例 #7
0
        public int SaveOrUpdate(BlogTagModel entity)
        {
            if (entity.ID != 0)
            {
                var dbEntity = BlogTagRepository.Get(entity.ID);
                if (dbEntity != null)
                {
                    BlogTagRepository.Update(dbEntity);

                    return dbEntity.ID;
                }
                throw new ArgumentException("Invalid id");
            }
            return BlogTagRepository.Save(entity);
        }
コード例 #8
0
 public void Update(BlogTagModel entity)
 {
     BlogTagRepository.Update(entity);
 }
コード例 #9
0
 public int Save(BlogTagModel entity)
 {
     return BlogTagRepository.Save(entity);
 }
コード例 #10
0
 public IHttpActionResult Save(BlogTagModel item)
 {
     try
     {
         if (item != null)
         {
             BlogTagService.SaveOrUpdate(item);
             return Ok(item);
         }
         return BadRequest("No se ha enviado información que almacenar.");
     }
     catch (HibernateAdoException hibernateException)
     {
         if (hibernateException.InnerException is GenericADOException)
         {
             if (hibernateException.InnerException.InnerException is OracleException)
             {
                 return InternalServerError(hibernateException.InnerException.InnerException);
             }
             return InternalServerError(hibernateException.InnerException);
         }
         return InternalServerError(hibernateException);
     }
     catch (Exception exception)
     {
         return InternalServerError(exception);
     }
 }
コード例 #11
0
 public void Update(BlogTagModel entity)
 {
     BlogTagRepository.Update(entity);
 }
コード例 #12
0
 public int Save(BlogTagModel entity)
 {
     return(BlogTagRepository.Save(entity));
 }