public HttpResponseMessage GetProject(int id) { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <List <WorkerHours> >(WorkerLogic.GetProject(id), new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage GetAllHours(int id) { return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <string>(WorkerLogic.GetAllHours(id), new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage GetAllHours(int id) { //curl -X GET -v http://localhost:59628/api/getAllHours/6 return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <string>(WorkerLogic.GetAllHours(id), new JsonMediaTypeFormatter()) }); }
public HttpResponseMessage SendMsg([FromBody] JObject data) { //curl -v -X POST -H "Content-type: application/json" -d "{\"sub\":\"malky8895\",\"body\":\"ddd\",\"id\":\"22\"}" http://localhost:59628/api/SendMsg if (ModelState.IsValid) { return((WorkerLogic.SendMsg((string)data["sub"], (string)data["body"], (int)data["id"])) ? new HttpResponseMessage(HttpStatusCode.OK) : new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new ObjectContent <String>("Can not send Email", new JsonMediaTypeFormatter()) }); } return(Global.ErrorList(ModelState)); }
public HttpResponseMessage UpdateStartHour([FromBody] JObject data) { if (ModelState.IsValid) { bool isFirst = (bool)data["isFirst"]; string s = (string)data["hour"]; return((isFirst ? WorkerLogic.UpdateStartHour((int)data["idProjectWorker"], Convert.ToDateTime(s)) : WorkerLogic.UpdateEndHour((int)data["idProjectWorker"], Convert.ToDateTime(s))) ? new HttpResponseMessage(HttpStatusCode.OK) : new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new ObjectContent <String>("Can not update in DB", new JsonMediaTypeFormatter()) }); } ; return(Global.ErrorList(ModelState)); }
public HttpResponseMessage UpdateStartHour([FromBody] JObject data) { //curl -v -X PUT -H "Content-type: application/json" -d "{\"Id\":\"7\",\"hour\":\"8\"}" http://localhost:59628/api/updateHours if (ModelState.IsValid) { bool isFirst = (bool)data["isFirst"]; string s = (string)data["hour"]; return((isFirst ? WorkerLogic.UpdateStartHour((int)data["idProjectWorker"], Convert.ToDateTime(s)) : WorkerLogic.UpdateEndHour((int)data["idProjectWorker"], Convert.ToDateTime(s))) ? new HttpResponseMessage(HttpStatusCode.OK) : new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new ObjectContent <String>("Can not update in DB", new JsonMediaTypeFormatter()) }); } ; return(Global.ErrorList(ModelState)); }
static void Main() { TicketLogic logicS = new TicketLogic(); WorkerLogic logic = new WorkerLogic(); logic.SaveToDatabase(); logicS.SaveToDatabase(); var container = BuildUnityContainer(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var login = new FormAutorization(); login.ShowDialog(); if (IsLogined) { Application.Run(container.Resolve <FormMain>()); } }
public WorkerController(WorkerLogic logic) { _logic = logic; }