Ejemplo n.º 1
0
        public async Task <IActionResult> PutTour(int id, Tour tour)
        {
            if (_context.Tours.Where(cl => cl.TourNaming == tour.TourNaming).Count() == 0)
            {
                if (id != tour.TourID)
                {
                    return(BadRequest());
                }

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

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

                return(NoContent());
            }
            else
            {
                return(BadRequest("Doublicate error"));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutSell(int id, Sell sell)
        {
            if (id != sell.SellID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutClient(int id, Client client)
        {
            if (_context.Clients.Where(cl => cl.ClientName == client.ClientName).Count() == 0)
            {
                if (id != client.ClientID)
                {
                    return(BadRequest());
                }

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

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

                return(NoContent());
            }
            else
            {
                return(BadRequest("Doublicate error"));
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            if (_context.Employees.Where(cl => cl.EmployeeName == employee.EmployeeName).Count() == 0)
            {
                if (id != employee.EmployeeID)
                {
                    return(BadRequest());
                }

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

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

                return(NoContent());
            }
            else
            {
                return(BadRequest("Doublicate error"));
            }
        }