public void UpdateDepartment(Department item, DepartmentDetail detail, IPersistenceContext context) { item.Id = detail.Id; item.Name = detail.Name; item.Description = detail.Description; item.Facility = context.Load<Facility>(detail.Facility.FacilityRef, EntityLoadFlags.Proxy); item.Deactivated = detail.Deactivated; }
public DepartmentSummary CreateSummary(Department item, IPersistenceContext context) { return new DepartmentSummary(item.GetRef(), item.Id, item.Name, item.Facility.Code, item.Facility.Name, item.Deactivated); }
public DepartmentDetail CreateDetail(Department item, IPersistenceContext context) { var facilityAssembler = new FacilityAssembler(); return new DepartmentDetail(item.GetRef(), item.Id, item.Name, item.Description, facilityAssembler.CreateFacilitySummary(item.Facility), item.Deactivated); }
public AddDepartmentResponse AddDepartment(AddDepartmentRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.Department, "request.Department"); var item = new Department(); var assembler = new DepartmentAssembler(); assembler.UpdateDepartment(item, request.Department, PersistenceContext); PersistenceContext.Lock(item, DirtyState.New); PersistenceContext.SynchState(); return new AddDepartmentResponse(assembler.CreateSummary(item, PersistenceContext)); }