/// <summary> /// Function to save work category group details. /// </summary> /// <param name="workCategoryGroup">work category group information.</param> public void InsertOrUpdate(WorkCategoryGroup workCategoryGroup) { if (workCategoryGroup == null) { throw new ArgumentNullException(WorkCategoryGroupConst); } if (workCategoryGroup.WorkCategoryGroupID == default(int)) { this.unitOfWork.Context.Entry(workCategoryGroup).State = EntityState.Added; } else { this.unitOfWork.Context.Entry(workCategoryGroup).State = EntityState.Modified; } }
/// <summary> /// Function to delete work category group information. /// </summary> /// <param name="id">work category group id</param> /// <param name="userId">The user identifier.</param> public void Delete(int id, int userId) { var workCategoryGroup = new WorkCategoryGroup { WorkCategoryGroupID = id, ModifiedByDeveloperID = userId }; this.unitOfWork.Context.Entry(workCategoryGroup).State = EntityState.Deleted; }
/// <summary> /// Function to validate work category group delete information. /// </summary> /// <param name="workCategoryGroup">work category group information</param> /// <returns> /// List of errors /// </returns> public ErrorListItem ValidateDelete(WorkCategoryGroup workCategoryGroup) { if (workCategoryGroup == null) { throw new ArgumentNullException(WorkCategoryGroupConst); } return this.unitOfWork.Context.ValidateWorkCategoryGroupDeleteInformation(workCategoryGroup.WorkCategoryGroupID > 0 ? workCategoryGroup.WorkCategoryGroupID : default(int?)).FirstOrDefault(); }
/// <summary> /// Maps to master details. /// </summary> /// <param name="workCategoryGroupItem">The Work category group item.</param> /// <returns>Master details information.</returns> private static MasterDetail MapToMasterDetails(WorkCategoryGroup workCategoryGroupItem) { return new MasterDetail() { Name = workCategoryGroupItem.WorkCategory, MasterDetailId = workCategoryGroupItem.WorkCategoryGroupID }; }