예제 #1
0
 /// <summary>
 /// Creates a AMS_Event_LatestEntity
 /// </summary>
 /// <param name="AMSEventLatestEntity"></param>
 /// <returns>_AMSEventLatest.Id</returns>
 public int AMS_Event_Latest(AMS_Event_LatestEntity AMSEventLatestEntity)
 {
     using (var scope = new TransactionScope())
     {
         var _AMSEventLatest = new AMS_Event_Latest
         {
             SiteId = AMSEventLatestEntity.SiteId
         };
         _unitOfWork.AMS_Event_LatestRepository.Insert(_AMSEventLatest);
         _unitOfWork.Save();
         scope.Complete();
         return(_AMSEventLatest.Id);
     }
 }
예제 #2
0
        /// <summary>
        /// Updates a AMSEventLatestEntity
        /// </summary>
        /// <param name="AMSEventLatestEntityId"></param>
        /// <param name="AMSEventLatestEntity"></param>
        /// <returns>success</returns>
        public bool UpdateAMS_Event_Latest(int AMSEventLatestEntityId, AMS_Event_LatestEntity AMSEventLatestEntity)
        {
            var success = false;

            if (AMSEventLatestEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var _AMSEventLatestEntity = _unitOfWork.AMS_Event_LatestRepository.GetByID(AMSEventLatestEntityId);
                    if (_AMSEventLatestEntity != null)
                    {
                        _AMSEventLatestEntity.SiteId = AMSEventLatestEntity.SiteId;
                        _unitOfWork.AMS_Event_LatestRepository.Update(_AMSEventLatestEntity);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }