Пример #1
0
        /// <summary>
        /// add as an asynchronous operation.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns>Device.</returns>
        public async Task <CS.EF.Models.Version> AddAsync(CS.EF.Models.Version entity)
        {
            _unitOfWork.GetRepository <CS.EF.Models.Version>().Add(entity);
            await _unitOfWork.CommitAsync();

            return(entity);
        }
Пример #2
0
        /// <summary>
        /// Updates the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="id">The identifier.</param>
        /// <returns>Device.</returns>
        public CS.EF.Models.Version Update(CS.EF.Models.Version entity, Guid id)
        {
            if (entity == null)
            {
                return(null);
            }

            CS.EF.Models.Version existing = _unitOfWork.GetRepository <CS.EF.Models.Version>().GetById(id);
            if (existing != null)
            {
                _unitOfWork.GetRepository <CS.EF.Models.Version>().Update(entity);
                _unitOfWork.Commit();
            }

            return(existing);
        }
Пример #3
0
        /// <summary>
        /// update as an asynchronous operation.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="id">The identifier.</param>
        /// <returns>Device.</returns>
        public async Task <CS.EF.Models.Version> UpdateAsync(CS.EF.Models.Version entity, Guid id)
        {
            if (entity == null)
            {
                return(null);
            }

            CS.EF.Models.Version existing = await _unitOfWork.GetRepository <CS.EF.Models.Version>().GetAsyncById(id);

            if (existing != null)
            {
                _unitOfWork.GetRepository <CS.EF.Models.Version>().Update(entity);
                await _unitOfWork.CommitAsync();
            }

            return(existing);
        }
Пример #4
0
 /// <summary>
 /// Deletes the specified entity.
 /// </summary>
 /// <param name="entity">The entity.</param>
 public void Delete(CS.EF.Models.Version entity)
 {
     _unitOfWork.GetRepository <CS.EF.Models.Version>().Delete(entity);
     _unitOfWork.Commit();
 }
Пример #5
0
 /// <summary>
 /// Adds the specified entity.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <returns>Device.</returns>
 public CS.EF.Models.Version Add(CS.EF.Models.Version entity)
 {
     _unitOfWork.GetRepository <CS.EF.Models.Version>().Add(entity);
     _unitOfWork.Commit();
     return(entity);
 }
Пример #6
0
 /// <summary>
 /// delete as an asynchronous operation.
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <returns>System.Int32.</returns>
 public async Task <int> DeleteAsync(CS.EF.Models.Version entity)
 {
     _unitOfWork.GetRepository <CS.EF.Models.Version>().Delete(entity);
     return(await _unitOfWork.CommitAsync());
 }