public void Add(Core.Customer domainCustomer)
        {
            var customer = _mapper.Map(domainCustomer);

            _context.Customers.AddObject(customer);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
 public IActionResult OnGet(int id)
 {
     Customer = customerData.GetCustomerById(id);
     if (Customer == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
        // Add customer to GameZone Database
        public void AddCustomer(Core.Customer cust)
        {
            var entity = new Customer
            {
                FistName = cust.FirstName,
                LastName = cust.LastName
            };

            _dbContext.Add(entity);
        }
Ejemplo n.º 4
0
 public static Model.Customers MapCustomer(Core.Customer customers)
 {
     return(new Model.Customers
     {
         CustomerId = customers.CustomerId,
         LastName = customers.LastName,
         FirstName = customers.FirstName,
         StoreId = customers.StoreId,
         Phone = customers.Phone,
         Address = customers.Address,
         City = customers.City,
         State = customers.State,
         FullName = customers.FullName
     });
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Возвращает запись поставщика из справочника. Если такой нет, то создает новую
 /// </summary>
 /// <param name="suppl"></param>
 /// <returns></returns>
 private Core.Customer GetSupplier(Inbound.СвЮЛ suppl)
 {
     Core.Customer cust = _Context.Customer.Where(c => c.INN == suppl.ИНН).FirstOrDefault();
     if (cust == null)
     {
         cust      = new Core.Customer();
         cust.INN  = suppl.ИНН;
         cust.KPP  = suppl.КПП;
         cust.OKDP = suppl.ОКДП;
         cust.OKPO = suppl.ОКПО;
         cust.Name = suppl.Название;
         _Context.Customer.Add(cust);
         _Context.SaveChanges();
     }
     return(cust);
 }
Ejemplo n.º 6
0
        public Customer Map(Core.Customer customer)
        {
            if (customer == null)
            {
                return(null);
            }

            return(new Customer
            {
                Customer_ID = customer.Id,
                City = customer.City,
                Company_Name = customer.CompanyName,
                Phone = customer.Phone,
                Postal_Code = customer.PostalCode
            });
        }
Ejemplo n.º 7
0
        public IActionResult OnGet(int?id)
        {
            if (id.HasValue)
            {
                Customer = customerData.GetCustomerById(id.Value);
                if (Customer == null)
                {
                    return(RedirectToPage("./NotFound"));
                }
            }
            else
            {
                Customer = new Core.Customer();
            }

            var memberships = membershipData.GetMemberships().ToList().Select(p => new { Id = p.Id, Display = p.MembershipType });

            Memberships = new SelectList(memberships, "Id", "Display");
            Gender      = htmlHelper.GetEnumSelectList <Gender>();
            City        = htmlHelper.GetEnumSelectList <City>();
            return(Page());
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Возвращает запись поставщика из справочника. Если такой нет, то создает новую
 /// </summary>
 /// <param name="suppl"></param>
 /// <returns></returns>
 private Core.Customer GetSupplier(Inbound.СвЮЛ suppl)
 {
     Core.Customer cust = _Context.Customer.Where(c=>c.INN == suppl.ИНН).FirstOrDefault();
     if (cust == null)
     {
         cust = new Core.Customer();
         cust.INN = suppl.ИНН;
         cust.KPP = suppl.КПП;
         cust.OKDP = suppl.ОКДП;
         cust.OKPO = suppl.ОКПО;
         cust.Name = suppl.Название;
         _Context.Customer.Add(cust);
         _Context.SaveChanges();
     }
     return cust;
 }