Beispiel #1
0
        public IActionResult Delete(TimeTaskDeleteViewModel model)
        {
            BackgroundJob.Delete(model.BackgroundJobId);

            _timeTaskRepository.DeleteTimeTask(model.TimeTaskId);
            _timeTaskRepository.Savechanges();

            return(RedirectToAction("Index", "TimeTask", new { id = model.SocketId }));
        }
Beispiel #2
0
        public IActionResult DeleteTimeTask(int timetaskId)
        {
            if (!_timeTaskRepo.TimeTaskExists(timetaskId))
            {
                return(NotFound());
            }

            var timeTaskObj = _timeTaskRepo.GetTimeTask(timetaskId);

            if (!_timeTaskRepo.DeleteTimeTask(timeTaskObj))
            {
                ModelState.AddModelError("", $"Something went wrong while deleting time task {timeTaskObj.Title}");
                return(StatusCode(500, ModelState));
            }

            return(NoContent());
        }