/// <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); }
/// <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); }
/// <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); }
/// <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(); }
/// <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); }
/// <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()); }