Пример #1
0
        public JsonResult Delete(long id)
        {
            TimesheetNote note = _context.TimesheetNote
                                 .Where(b => b.Id == id)
                                 .FirstOrDefault();

            _context.Entry(note).State = EntityState.Deleted;
            _context.SaveChanges();

            return(Json(Ok()));
        }
Пример #2
0
        public IActionResult Put(int id, [FromBody] TimesheetNote note)
        {
            if (note != null)
            {
                var existingTimesheet = _timeSheetRepository.GetTimsheetById(id);
                existingTimesheet.AddTimesheetNote(_mediator, note);

                _timeSheetRepository.UpdateTimesheet(existingTimesheet);

                return(Ok(note.Id));
            }
            return(BadRequest());
        }