public async Task<HttpResponseMessage> GetCustomer(Request<int> id)
 {
     if (!AuthenticationLogic.IsTokenCorrect(id.Token, id.Login))
         return new HttpResponseMessage(HttpStatusCode.Unauthorized);
     var response = Request.CreateResponse(HttpStatusCode.OK, await new CustomerLogic().GetCustomer(id.Content));
     return response;
 }
 public async Task<HttpResponseMessage> SaveCustomer(Request<DtoCustomer> c)
 {
     if (!AuthenticationLogic.IsTokenCorrect(c.Token, c.Login))
         return new HttpResponseMessage(HttpStatusCode.Unauthorized);
     var response = Request.CreateResponse(HttpStatusCode.OK, await new CustomerLogic().SaveCustomer(c.Content));
     return response;
 }
 public async Task<HttpResponseMessage> GetCustomers(Request<string> filter)
 {
     var customerLogic = new CustomerLogic();
     if (!AuthenticationLogic.IsTokenCorrect(filter.Token, filter.Login))
         return new HttpResponseMessage(HttpStatusCode.Unauthorized);
     var response = Request.CreateResponse(HttpStatusCode.OK, await customerLogic.GetCustomers(filter.Content));
     return response;
 }
        public async Task <HttpResponseMessage> SavePosition(Request <DtoPosition> p)
        {
            if (!AuthenticationLogic.IsTokenCorrect(p.Token, p.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, await new PositionLogic().SavePosition(p.Content));

            return(response);
        }
        public async Task <HttpResponseMessage> GetPosition(Request <int> id)
        {
            if (!AuthenticationLogic.IsTokenCorrect(id.Token, id.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, await new PositionLogic().GetPosition(id.Content));

            return(response);
        }
Example #6
0
        public async Task <HttpResponseMessage> AddCourse(Request <DtoService> s)
        {
            if (!AuthenticationLogic.IsTokenCorrect(s.Token, s.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, await new ServiceLogic().AddService(s.Content));

            return(response);
        }
        public async Task <HttpResponseMessage> SaveEmployee(Request <DtoEmployee> e)
        {
            if (!AuthenticationLogic.IsTokenCorrect(e.Token, e.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, await new EmployeeLogic().SaveEmployee(e.Content));

            return(response);
        }
Example #8
0
        public async Task <HttpResponseMessage> GetSports(Request <int> r)
        {
            if (!AuthenticationLogic.IsTokenCorrect(r.Token, r.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, await new SportTypeLogic().GetAllSportTypes());

            return(response);
        }
Example #9
0
        public async Task <HttpResponseMessage> GetServices(Request <ServiceFilter> request)
        {
            if (!AuthenticationLogic.IsTokenCorrect(request.Token, request.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK,
                                                  await new ServiceLogic().GetServices(request.Content));

            return(response);
        }
Example #10
0
        public async Task <HttpResponseMessage> EnrolCourse(Request <EnrolRequest> request)
        {
            if (!AuthenticationLogic.IsTokenCorrect(request.Token, request.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK,
                                                  await new ServiceLogic().EnrolCourse(request.Content.CustomerId, request.Content.ServiceId));

            return(response);
        }
        public async Task <HttpResponseMessage> GetEmployees(Request <string> filter)
        {
            if (!AuthenticationLogic.IsTokenCorrect(filter.Token, filter.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK,
                                                  await new EmployeeLogic().GetEmployees(filter.Content));

            return(response);
        }
Example #12
0
        public async Task <HttpResponseMessage> SaveSportType(Request <DtoSportType> st)
        {
            if (!AuthenticationLogic.IsTokenCorrect(st.Token, st.Login))
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
            var response = Request.CreateResponse(HttpStatusCode.OK,
                                                  await new SportTypeLogic().SaveSportType(st.Content));

            return(response);
        }