Ejemplo n.º 1
0
        public async Task <IActionResult> PutOffices(long id, Offices offices)
        {
            if (id != offices.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutMeetings(long id, [FromBody] Meetings meetings)
        {
            if (id != meetings.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutEmployees(long id, [FromBody] CreateEmployeeDto createEmployeeDto)
        {
            if (id != createEmployeeDto.Id)
            {
                return(BadRequest());
            }
            var employee = _mapper.Map <Employees>(createEmployeeDto);

            employee.UpdatedAt = DateTime.Now;
            _context.Employees.Update(employee);

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

            return(Ok());
        }