Exemple #1
0
        public async Task <IActionResult> PutTimeTracking(int id, TimeTrackings timeTracking)
        {
            if (id != timeTracking.timer_id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutEmployeeManager(int id, EmployeeManager employeeManager)
        {
            if (id != employeeManager.manager_id)
            {
                return(BadRequest());
            }

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

            try
            {
                employeeManager.password = Crypter.Blowfish.Crypt(employeeManager.password);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeManagerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #3
0
        public async Task <IActionResult> PutEmployeeInfo([FromRoute] int id, [FromBody] EmployeeInfo employeeInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employeeInfo.id_num)
            {
                return(BadRequest());
            }

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

            try
            {
                employeeInfo.password = Crypter.Blowfish.Crypt(employeeInfo.password);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }