public static void MapTo(this JobAdList list, JobAdListEntity entity) { entity.name = list.Name; entity.ownerId = list.OwnerId; entity.isDeleted = list.IsDeleted; entity.createdTime = list.CreatedTime; entity.listType = list.ListType; }
void IJobAdListsRepository.CreateList(JobAdList list) { using (var dc = CreateContext()) { dc.JobAdListEntities.InsertOnSubmit(list.Map()); dc.SubmitChanges(); } }
public static JobAdListEntity Map(this JobAdList list) { var entity = new JobAdListEntity { id = list.Id }; list.MapTo(entity); return(entity); }
void IJobAdListsRepository.UpdateList(JobAdList list) { using (var dc = CreateContext()) { var entity = GetListEntity(dc, list.Id); if (entity != null) { list.MapTo(entity); dc.SubmitChanges(); } } }
private static bool CanAccessFolder(IMember member, JobAdList folder) { if (member == null) { return(false); } if (folder == null) { return(false); } if (folder.IsDeleted) { return(false); } return(true); }
private static bool CanAccessBlockList(IMember member, JobAdList blockList, bool allowDeleted) { if (member == null) { return(false); } if (blockList == null) { return(false); } if (!allowDeleted && blockList.IsDeleted) { return(false); } return(true); }
private void Validate(IHasId <Guid> member, JobAdList folder, string newName) { if (string.IsNullOrEmpty(newName)) { throw new ValidationErrorsException(new RequiredValidationError("name")); } // Don't need to check the name of a deleted folder. if (folder.IsDeleted) { return; } // Check no folder with the same name exists. if (_jobAdListsQuery.GetList <JobAdFolder>(member.Id, newName, ListTypes) != null) { throw new ValidationErrorsException(new DuplicateValidationError("Name")); } }
void IJobAdListsCommand.UpdateList(JobAdList jobAdList) { jobAdList.Validate(); _repository.UpdateList(jobAdList); }
void IJobAdListsCommand.CreateList(JobAdList jobAdList) { jobAdList.Prepare(); jobAdList.Validate(); _repository.CreateList(jobAdList); }