public IActionResult Delete(int id) { Entities.WorkSession project = _dataRepository.Get(id); if (project == null) { return(NotFound("The Employee record couldn't be found.")); } _dataRepository.Delete(project); return(Ok()); }
public IActionResult Post([FromBody] Entities.WorkSession workSession) { if (workSession == null) { return(BadRequest("work session is null.")); } _dataRepository.Add(workSession); return(CreatedAtRoute( "Get", new { workSession.Id }, workSession)); }
public IActionResult Update(int id, [FromBody] Entities.WorkSession workSession) { if (workSession == null) { return(BadRequest("work session is null.")); } var oldWorkSession = _dataRepository.Get(workSession.Id); _dataRepository.Update(oldWorkSession, workSession); return(CreatedAtRoute( "Get", new { workSession.Id }, workSession)); }