Esempio n. 1
0
        // GET: Customers/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var customer = await _context.GetCustomerAsync(id.Value);

            if (customer == null)
            {
                return(NotFound());
            }

            return(View(customer));
        }
        public async Task <IActionResult> Edit(CustomerId id, [FromBody] EditCustomer model)
        {
            var customer = await _context.GetCustomerAsync(id);

            if (customer == null)
            {
                return(NotFound());
            }
            customer.Firstname = model.Firstname;
            customer.Lastname  = model.Lastname;
            await _context.SaveChangesAsync();

            return(Ok(Mappers.Map(customer)));
        }