示例#1
0
        public async Task <IActionResult> PutProspectiveCustomer(int id, ProspectiveCustomer prospectiveCustomer)
        {
            if (id != prospectiveCustomer.Id)
            {
                return(BadRequest());
            }

            _context.Entry(prospectiveCustomer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProspectiveCustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <ProspectiveCustomer> > PostProspectiveCustomer(ProspectiveCustomer prospectiveCustomer)
        {
            _context.ProspectiveCustomers.Add(prospectiveCustomer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProspectiveCustomer", new { id = prospectiveCustomer.Id }, prospectiveCustomer));
        }