Esempio n. 1
0
        public async Task <ActionResult <Timesheet> > PostTimesheet(TimesheetViewModel timesheetViewModel)
        {
            bool success = await _timesheetRepository.Add(new Timesheet(timesheetViewModel));

            if (!success)
            {
                return(Ok("Error on adding timesheet...duplicate entry."));
            }
            foreach (TimesheetRowViewModel item in timesheetViewModel.TimesheetRows)
            {
                await _timesheetRowRepository.Add(new TimesheetRow(item));
            }
            return(Ok(timesheetViewModel));
        }