Example #1
0
        public async Task <IActionResult> PutLookup(int id, Lookup lookup)
        {
            if (id != lookup.LookupId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <EmployeeSchedule> > PutEmployeeSchedule([FromBody] EmployeeSchedule employeeSchedule)
        {
            if (null == employeeSchedule)
            {
                return(BadRequest());
            }

            // _context.Entry(employeeSchedule).State = EntityState.Modified;
            _context.EmployeeSchedules.Update(employeeSchedule);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeScheduleExists(employeeSchedule.EmployeeScheduleId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            employeeSchedule = await _context.EmployeeSchedules.Include(E => E.Shift).SingleOrDefaultAsync(x => x.EmployeeScheduleId == employeeSchedule.EmployeeScheduleId);

            return(Ok(employeeSchedule));
        }
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            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());
        }
Example #4
0
        public async Task <IActionResult> PutUser(int id, User user)
        {
            /*
             * if (id != user.Id)
             * {
             *   return BadRequest();
             * }
             */
            _context.Entry(user).State = EntityState.Modified;

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

            return(NoContent());
        }
        public async Task <IActionResult> PutParentCompany(int id, ParentCompany parentCompany)
        {
            if (id != parentCompany.ParentCompanyId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <ActionResult <EmployeeLeave> > PutEmployeeLeave([FromBody] EmployeeLeave employeeLeave)
        {
            if (null == employeeLeave)
            {
                return(BadRequest());
            }

            // _context.Entry(employeeSchedule).State = EntityState.Modified;
            _context.EmployeeLeaves.Update(employeeLeave);

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

            employeeLeave = await _context.EmployeeLeaves.FindAsync(employeeLeave.id);

            return(Ok(employeeLeave));
        }
        public async Task <IActionResult> PutShift(int id, Schedule schedule)
        {
            if (id != schedule.ScheduleId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #8
0
        public async Task <IActionResult> PutShift([FromForm] Shift shift)
        {
            if (null == shift)
            {
                return(BadRequest());
            }

            // _context.Entry(shift).State = EntityState.Modified;
            _context.Shifts.Update(shift);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ShiftExists(shift.ShiftId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #9
0
        public async Task <IActionResult> PutEmployee([FromBody] AppTask appTask)
        {
            if (null == appTask)
            {
                return(BadRequest());
            }

            _context.Task.Update(appTask);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTask", new { id = appTask.AppTaskId }, appTask));
        }
Example #10
0
        public async Task <IActionResult> PutTaskPriority([FromForm] TaskSetting appTask)
        {
            if (null == appTask)
            {
                return(BadRequest());
            }

            _context.TaskSettings.Update(appTask);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTaskSettings", new { id = appTask.Id }, appTask));
        }
Example #11
0
        public async Task <IActionResult> PutEmployee([FromBody] EmployeeStatus employeeStatus)
        {
            if (null == employeeStatus)
            {
                return(BadRequest());
            }

            // _context.Entry(employeeStatus).State = EntityState.Modified;
            _context.EmployeeStatuses.Update(employeeStatus);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(Ok(employeeStatus));
        }
        public async Task <IActionResult> PutDepartment([FromForm] Department department)
        {
            if (null == department)
            {
                return(BadRequest());
            }


            _context.Departments.Update(department);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }



            return(NoContent());
        }