public ConsignmentBusinessModel GetConsignmentByNumber(int number) { var consignment = this.uow.Consignments.GetAll().SingleOrDefault(c => c.Number == number); var mapper = new ConsignmentMapper(); return(mapper.Map(consignment)); }
public void UpdateConsignment(ConsignmentBusinessModel consignment) { var mapper = new ConsignmentMapper(); this.uow.Consignments.Update(mapper.Map(consignment)); this.uow.Commit(); }
public ConsignmentBusinessModel GetConsignmentById(int id) { var mapper = new ConsignmentMapper(); var consignment = this.uow.Consignments.GetById(id); return(mapper.Map(consignment)); }
public void ConsignmentModelToEntityMappingTest() { var consignmentModel = fixture.Create <ConsignmentBusinessModel>(); var consignmentMapper = new ConsignmentMapper(); var consignment = consignmentMapper.Map(consignmentModel); Assert.AreEqual(consignmentModel.Id, consignment.Id, "Id is not correct"); Assert.AreEqual(consignmentModel.ArrivalDate, consignment.ArrivalDate, "ArrivalDate is not correct"); Assert.AreEqual(consignmentModel.WriteOffDate, consignment.WriteOffDate, "WriteOffDate is not correct"); Assert.AreEqual(consignmentModel.Item, consignment.Item, "Item is not correct"); }
public void UpdateConsignmentTest() { this.testConsignment = this.fixture.Create<Consignment>(); this.testConsignment.Id = 1; var mapper = new ConsignmentMapper(); this.consignmentFacade.UpdateConsignment(mapper.Map(this.testConsignment)); var result = this.consignmentFacade.GetConsignmentById(this.testConsignment.Id); Assert.AreEqual(this.testConsignment.Id, result.Id); Assert.AreEqual(this.testConsignment.ArrivalDate, result.ArrivalDate); Assert.AreEqual(this.testConsignment.WriteOffDate, result.WriteOffDate); }
public void UpdateConsignmentTest() { this.testConsignment = this.fixture.Create <Consignment>(); this.testConsignment.Id = 1; var mapper = new ConsignmentMapper(); this.consignmentFacade.UpdateConsignment(mapper.Map(this.testConsignment)); var result = this.consignmentFacade.GetConsignmentById(this.testConsignment.Id); Assert.AreEqual(this.testConsignment.Id, result.Id); Assert.AreEqual(this.testConsignment.ArrivalDate, result.ArrivalDate); Assert.AreEqual(this.testConsignment.WriteOffDate, result.WriteOffDate); }
public void ConsignmentEntityToModelMappingTest() { var consignment = fixture.Create <Consignment>(); var consignmentMapper = new ConsignmentMapper(); var consignmentModel = consignmentMapper.Map(consignment); Assert.AreEqual(consignment.Id, consignmentModel.Id, "Id is not correct"); Assert.AreEqual(consignment.Number, consignmentModel.Number, "Number is not correct"); Assert.AreEqual(consignment.ArrivalDate, consignmentModel.ArrivalDate, "ArrivalDate is not correct"); Assert.AreEqual(consignment.WriteOffDate, consignmentModel.WriteOffDate, "WriteOffDate is not correct"); Assert.AreEqual(consignment.Item, consignmentModel.Item, "Item is not correct"); Assert.IsNotNull(consignmentModel.Inventories); }
public ConsignmentBusinessModel CreateConsignment(int itemId, ConsignmentBusinessModel consignment) { ConsignmentBusinessModel consNew; var mapper = new ConsignmentMapper(); int id = 0; using (var uowNew = new LibraryUow()) { var item = uowNew.Items.GetById(itemId); var entryConsignment = mapper.Map(consignment); entryConsignment.Item = item; uowNew.Consignments.Add(entryConsignment); uowNew.Commit(); id = entryConsignment.Id; } consNew = mapper.Map(this.uow.Consignments.GetById(id)); consignment.Id = consNew.Id; consignment.Number = consNew.Number; return consNew; }
public ConsignmentBusinessModel CreateConsignment(int itemId, ConsignmentBusinessModel consignment) { ConsignmentBusinessModel consNew; var mapper = new ConsignmentMapper(); int id = 0; using (var uowNew = new LibraryUow()) { var item = uowNew.Items.GetById(itemId); var entryConsignment = mapper.Map(consignment); entryConsignment.Item = item; uowNew.Consignments.Add(entryConsignment); uowNew.Commit(); id = entryConsignment.Id; } consNew = mapper.Map(this.uow.Consignments.GetById(id)); consignment.Id = consNew.Id; consignment.Number = consNew.Number; return(consNew); }
public ConsignmentBusinessModel GetConsignmentByNumber(int number) { var consignment = this.uow.Consignments.GetAll().SingleOrDefault(c => c.Number == number); var mapper = new ConsignmentMapper(); return mapper.Map(consignment); }
public ConsignmentBusinessModel GetConsignmentById(int id) { var mapper = new ConsignmentMapper(); var consignment = this.uow.Consignments.GetById(id); return mapper.Map(consignment); }