Exemple #1
0
        public async Task <IActionResult> PutTemporaryCustomer(int id, TemporaryCustomer temporaryCustomer)
        {
            if (id != temporaryCustomer.Id)
            {
                return(BadRequest());
            }

            temporaryCustomer.Status = true;
            _context.Entry(temporaryCustomer).State = EntityState.Modified;

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

            return(Ok());
        }
Exemple #2
0
        public async Task <ActionResult> PostTemporaryCustomer(TemporaryCustomer temporaryCustomer)
        {
            temporaryCustomer.Status = true;
            _context.TemporaryCustomer.Add(temporaryCustomer);
            await _context.SaveChangesAsync();

            return(StatusCode(201));
        }