public async Task DeleteTimesheet(TimesheetIdInput input)
        {
            var timesheet = await _context.TimeSheets.FindAsync(input.TimesheetId);

            _context.TimeSheets.Remove(timesheet);
            await _context.SaveChangesAsync();
        }
Beispiel #2
0
        public async Task <object> GetTimesheetMaterials(TimesheetIdInput input)
        {
            try
            {
                var mat = await _context.MaterialItems.Where(x => x.TimeSheetId == input.TimesheetId).ToArrayAsync();

                var non = await _context.NonMaterialItems.Where(x => x.TimeSheetId == input.TimesheetId).ToArrayAsync();

                return(new
                {
                    material = mat,
                    nonMaterial = non
                });
            }
            catch
            {
                return(null);
            }
        }
Beispiel #3
0
        public async Task <SimpleResult> DeleteTimesheet(TimesheetIdInput input)
        {
            try
            {
                await _timesheet.DeleteTimesheet(input);

                return(new SimpleResult
                {
                    IsSuccess = true
                });
            }
            catch
            {
                return(new SimpleResult
                {
                    IsSuccess = false
                });
            }
        }
Beispiel #4
0
        public async Task <JsonResult> GetTimesheetMaterials([FromBody] TimesheetIdInput input)
        {
            var result = await _timesheet.GetTimesheetMaterials(input);

            return(await GenerateResult(result, _userSettings));
        }
Beispiel #5
0
        public async Task <JsonResult> DeleteTimesheet([FromBody] TimesheetIdInput input)
        {
            var result = await _timesheet.DeleteTimesheet(input);

            return(await GenerateResult(result, _userSettings));
        }