public void Update(Orders entity) { using (_session.BeginTransaction()) { _session.Update(entity); _session.Transaction.Commit(); } }
public void Save(Orders entity) { var orderState = _session.QueryOver<OrderState>().Take(1).List().FirstOrDefault(); if (entity.State == null) entity.State = orderState; _session.Save(entity); }
//MAPPING ORDER //Maps entity to data object //Entity--> object data public static Library.Order MapEFWithOrder(Entities.Orders EOrder) { return(new Library.Order { OID = EOrder.Oid, CID = EOrder.Cid, LID = EOrder.Lid, OrderType = EOrder.OrderType, OrderTime = EOrder.OrderTime }); }
public void MakeOrder(int customerId, int storeId, Order blogic) { var order = new DataAccess.Entities.Orders { CustomerId = customerId, LocationId = storeId, Date = blogic.OrderDate }; _dbContext.Orders.Add(order); _dbContext.SaveChanges(); blogic.OrderId = order.OrderId; }
public void SaveOrder() { var user = _userRepository.Get("*****@*****.**"); var deliveryType = _deliveryTypesRepository.GetAll().First(); Assert.IsNotNull(user); var order = new Orders(user, DateTime.Now, Convert.ToDecimal(29.99), deliveryType, _orderStateRepository.GetAll().FirstOrDefault()); Assert.AreEqual(0, order.Id); _ordersRepository.Save(order); Assert.AreNotEqual(0, order.Id); }
public void SaveOrderDetails() { var user = _userRepository.Get("*****@*****.**"); var deliveryType = _deliveryTypesRepository.GetAll().First(); var product = _productsRepository.GetAll().First(); Assert.IsNotNull(product); Assert.IsNotNull(user); var order = new Orders(user,DateTime.Now,Convert.ToDecimal(98765),deliveryType, _orderStateRepository.GetAll().First()); _ordersRepository.Save(order); Assert.AreNotEqual(0,order.Id); var orderDetails = new OrderDetails(order, product, 1, Convert.ToDecimal(98765)); Assert.AreEqual(0,orderDetails.ID); _orderDetailsRepository.Save(orderDetails); Assert.AreNotEqual(0,orderDetails.ID); }