예제 #1
0
        public async Task <IActionResult> CreateShift([FromBody] HumanResources.Shift value)
        {
            _db.HumanResources_Shift.Add(value);
            await _db.SaveChangesAsync();

            return(Ok(value));
        }
예제 #2
0
        public async Task <IActionResult> EditShift(byte shiftID, [FromBody] HumanResources.Shift value)
        {
            var existing = await _db.HumanResources_Shift.FirstOrDefaultAsync(x => x.ShiftID == shiftID);

            if (existing == null)
            {
                return(NotFound());
            }

            existing.ShiftID      = value.ShiftID;
            existing.Name         = value.Name;
            existing.StartTime    = value.StartTime;
            existing.EndTime      = value.EndTime;
            existing.ModifiedDate = value.ModifiedDate;

            _db.HumanResources_Shift.Update(existing);
            await _db.SaveChangesAsync();

            return(NoContent());
        }