public void UpdateCustomer(Domain.Model.Customer customer) { var cstm = _dbContext.Customer.FirstOrDefault(x => x.CstmId == customer.CstmId); cstm.CstmDefaultStoreLoc = customer.CstmDefaultStoreLocation; _dbContext.Update(cstm); }
public static Model.Customer MapCustomerWithOrders(Domain.Model.Customer customer) { return(new Model.Customer { CstmId = customer.CstmId, CstmFirstName = customer.CstmFirstName, CstmLastName = customer.CstmLastName, CstmEmail = customer.CstmEmail, CstmDefaultStoreLoc = customer.CstmDefaultStoreLocation, ProductOrder = customer.ProductOrder.Select(MapProductOrder).ToList() }); }
public Domain.Model.Customer GetByCustomerId(int customerId) { var customer = (from a in _dbContext.Customers where a.CustomerId == customerId select a).FirstOrDefault(); if (customer == null) { return(new Domain.Model.Customer()); } var viewModel = new Domain.Model.Customer { Id = customer.CustomerId, FirstName = customer.FirstName, LastName = customer.LastName, Dni = customer.Dni, Email = customer.Email }; return(viewModel); }
public void AddCustomer(Domain.Model.Customer customer) { Model.Customer entity = Mapper.MapCustomerWithOrders(customer); _dbContext.Add(entity); }
public void merge(Domain.Model.Customer entity) { throw new NotImplementedException(); }
/// <summary> /// Returns the order to be added to the database, given customer ID and location ID /// </summary> /// <param name="customerId"></param> /// <param name="locationId"></param> /// <returns></returns> //This works: add an order based on location and customer id public pamela_soulis_project1.Domain.Model.Orders AddOrder(Domain.Model.Orders order, Domain.Model.Customer customer, Domain.Model.Location location) { var orderDate = DateTime.Today; var orderEntity = new Domain.Model.Orders { CustomerId = customer.CustomerId, LocationId = location.LocationId, Date = orderDate }; return(orderEntity); }