public void StopTask(TContextDto context, int currentTaskID) { try { var states = new TracktorStates(context, _db); states.Stop(currentTaskID); } catch (Exception ex) { throw new WebFaultException <string>(ex.Message, HttpStatusCode.BadRequest); } }
public void SwitchTask(TContextDto context, int currentTaskID, int newTaskID) { try { var startTask = _db.TTasks.Single(t => t.TTaskID == newTaskID); if (startTask.TProject.TUserID != context.TUserID) { throw new Exception("Invalid Task ID."); } var states = new TracktorStates(context, _db); states.Stop(currentTaskID); states.Start(newTaskID); } catch (Exception ex) { throw new WebFaultException <string>(ex.Message, HttpStatusCode.BadRequest); } }