示例#1
0
        public async Task <IActionResult> Post(EmployeeSalaryCalculationSystem.INFRA.Models.WorkItem task)
        {
            _unitOfWork.TaskRepository.Add(task);
            await this._unitOfWork.SaveChangesAsync();

            return(this.Ok(task));
        }
示例#2
0
        public async Task <IActionResult> Patch(int id, EmployeeSalaryCalculationSystem.INFRA.Models.WorkItem task)
        {
            var existingTaskDetail = await _unitOfWork.TaskRepository.Get(id);

            if (existingTaskDetail == null)
            {
                return(NotFound());
            }
            existingTaskDetail.Name        = task.Name;
            existingTaskDetail.NoOfHours   = task.NoOfHours;
            existingTaskDetail.IsCompleted = task.IsCompleted;

            _unitOfWork.TaskRepository.Update(existingTaskDetail);
            await this._unitOfWork.SaveChangesAsync();

            return(this.Ok(task));
        }