Beispiel #1
0
        public async Task <IActionResult> CreateTimeEntry([FromBody] TimeEntry timeEntry)
        {
            timeEntry.AllocationId = 2;
            timeEntry.IsApproved   = false;
            if (ModelState.IsValid)
            {
                try
                {
                    var entryID = _timesheetService.CreateTimeEntry(timeEntry);
                    if (entryID > 0)
                    {
                        return(Ok(entryID));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                catch (Exception ex)
                {
                    return(BadRequest());
                }
            }

            return(BadRequest());
        }