/// <summary> /// Function to save estimation category details. /// </summary> /// <param name="estimationCategory">estimation category information.</param> public void InsertOrUpdate(EstimationCategory estimationCategory) { if (estimationCategory == null) { throw new ArgumentNullException(EstimationCategoryConstant); } if (estimationCategory.EstimationCategoryID == default(int)) { this.unitOfWork.Context.Entry(estimationCategory).State = EntityState.Added; } else { this.unitOfWork.Context.Entry(estimationCategory).State = EntityState.Modified; } }
/// <summary> /// Maps to master details. /// </summary> /// <param name="estimationCategoryItem">The role group item.</param> /// <returns>Master details information.</returns> private static MasterDetail MapToMasterDetails(EstimationCategory estimationCategoryItem) { return new MasterDetail() { Name = estimationCategoryItem.Name, MasterDetailId = estimationCategoryItem.EstimationCategoryID, GroupId = estimationCategoryItem.RoleGroupID }; }
/// <summary> /// Function to validate estimation category delete information. /// </summary> /// <param name="estimationCategory">estimation category information</param> /// <returns> /// List of errors /// </returns> public ErrorListItem ValidateDelete(EstimationCategory estimationCategory) { if (estimationCategory == null) { throw new ArgumentNullException(EstimationCategoryConstant); } return this.unitOfWork.Context.ValidateDeleteEstimationCategoryInformation(estimationCategory.EstimationCategoryID > 0 ? estimationCategory.EstimationCategoryID : default(int?)).FirstOrDefault(); }
/// <summary> /// Function to delete estimation category information. /// </summary> /// <param name="id">estimation category id</param> public void Delete(int id) { var estimationCategory = new EstimationCategory { EstimationCategoryID = id }; this.unitOfWork.Context.Entry(estimationCategory).State = EntityState.Deleted; }