public ActionResult <ItemsResponse <State> > SelectAll()
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                List <State> state = _lService.SelectAllStates();

                if (state == null)
                {
                    code     = 404;
                    response = new ErrorResponse("Location not found.");
                }
                else
                {
                    response = new ItemsResponse <State> {
                        Items = state
                    };
                }
            }
            catch (Exception e)
            {
                code     = 500;
                response = new ErrorResponse(e.Message);
                base.Logger.LogError(e.ToString());
            }
            return(StatusCode(code, response));
        }
        public ActionResult <ItemsResponse <Influencer> > GetAll()
        {
            ActionResult result = null;

            try
            {
                List <Influencer> list = _influencerService.SelectAll();

                if (list == null)
                {
                    result = NotFound404(new ErrorResponse("There are no influencers."));
                }
                else
                {
                    ItemsResponse <Influencer> response = new ItemsResponse <Influencer>();
                    response.Items = list;
                    result         = Ok200(response);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                result = StatusCode(500, "Internal Server Error");
            }
            return(result);
        }
Example #3
0
        public void SuccessTrainingNullStatus()
        {
            Console.WriteLine("SuccessTrainingNullStatus Start");
            var JsonString = File.ReadAllText("../../../Files/GetItems.txt");
            var Client     = MockGenerator.MockRestClient <ItemsResponse>(HttpStatusCode.OK, JsonString);
            HacarusVisualInspection VisualInspection = new HacarusVisualInspection(Client);
            ItemsResponse           Response         = VisualInspection.GetItems();

            Assert.IsNull(Response.Data.Training[0].Assessment);
            Assert.IsTrue(Response.Data.Training[0].ConfirmedAssessment);
            Assert.IsTrue(Response.Data.Training[0].Date.Equals(DateTime.Parse("Mon, 10 Jun 2019 08:22:02 GMT").ToUniversalTime()));
            Assert.IsTrue(Response.Data.Training[0].DefaultImage.Equals("https://hacarus-saas-data.s3.amazonaws.com/raw/b21d29f794e781e12f466a1fcc1bf1a1596e5320"));
            Assert.IsNull(Response.Data.Training[0].Description);
            Assert.IsTrue(Response.Data.Training[0].DetectionAccuracy.Equals(0));
            Assert.IsTrue(Response.Data.Training[0].DetectedObjects.Equals(0));
            Assert.IsNull(Response.Data.Training[0].FinishedDate);
            Assert.IsNull(Response.Data.Training[0].Good);
            Assert.IsTrue(Response.Data.Training[0].IsTrainingData);
            Assert.IsTrue(Response.Data.Training[0].ItemId.Equals("T1-22-01"));
            Assert.IsTrue(Response.Data.Training[0].Label.Equals("Job id is T1-22-01"));
            Assert.IsTrue(Response.Data.Training[0].OverrideAssessment);
            Assert.IsTrue(Response.Data.Training[0].Status.Equals("pending"));
            Assert.IsTrue(Response.Data.Training[0].ThumbnailImage.Equals("https://hacarus-saas-data.s3.amazonaws.com/thumbnail/b21d29f794e781e12f466a1fcc1bf1a1596e5320"));
            Console.WriteLine("SuccessTrainingNullStatus End");
        }
        public ActionResult <ItemResponse <Location> > GetByCreatedBy(int createdBy, int pageIndex, int pageSize)
        {
            ItemsResponse <Location> response = new ItemsResponse <Location>();

            int          code          = 200;
            BaseResponse errorResponse = null;

            try
            {
                Paged <Location> page = _lService.GetByCreatedBy(createdBy, pageIndex, pageSize);

                if (page == null)
                {
                    code          = 404;
                    errorResponse = new ErrorResponse("Location not found.");

                    return(NotFound404(errorResponse));
                }
                else
                {
                    errorResponse = new ItemResponse <Paged <Location> > {
                        Item = page
                    };
                }
            }
            catch (Exception e)
            {
                code          = 500;
                errorResponse = new ErrorResponse("Internal Server Exception... " + e.Message);
            }

            return(StatusCode(code, errorResponse));
        }
Example #5
0
        public HttpResponseMessage SelectBySceneId(int sceneId)
        {
            ItemsResponse <Character> response = new ItemsResponse <Character>();

            response.Items = CharacterService.SelectBySceneId(sceneId);
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Example #6
0
        public ActionResult <ItemResponse <int> > Add(List <FileAddRequest> modelList)
        {
            ObjectResult result = null;

            int userId = _authService.GetCurrentUserId();

            try
            {
                List <int>          id       = _service.Add(modelList, userId);
                ItemsResponse <int> response = new ItemsResponse <int>()
                {
                    Items = id
                };

                result = StatusCode(201, response);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                ErrorResponse response = new ErrorResponse(ex.Message);

                result = StatusCode(500, response);
            }

            return(result);
        }
        public HttpResponseMessage GetYields([FromUri] int zoneId, [FromUri] int CropId)
        {
            ItemsResponse <WeatherStationCrop> response = new ItemsResponse <WeatherStationCrop>();

            response.Items = WeatherStationCropsService.GetYields(zoneId, CropId);
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public ActionResult <ItemResponse <List <Role> > > GetRole()
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                List <Role> role = _userService.GetRoles();
                if (role == null)
                {
                    code     = 404;
                    response = new ErrorResponse("App Resource not found");
                }
                else
                {
                    response = new ItemsResponse <Role> {
                        Items = role
                    };
                }
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse(ex.Message);
                base.Logger.LogError(ex.ToString());
            }
            return(StatusCode(code, response));
        }
Example #9
0
        public ActionResult <ItemsResponse <BusinessTypesTotalCountByYear> > GetTotalBusinessCount(int year)
        {
            ItemsResponse <BusinessTypesTotalCountByYear> resp  = null;
            List <BusinessTypesTotalCountByYear>          model = _businessVenturesService.GetBusinessTotalCountsByYear(year);

            try
            {
                if (model == null)
                {
                    return(NotFound404(new ErrorResponse("Items Not Found")));
                }
                else
                {
                    resp = new ItemsResponse <BusinessTypesTotalCountByYear>
                    {
                        Items = model
                    };
                    return(Ok200(resp));
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                return(StatusCode(500, new ErrorResponse(ex.Message)));
            }
        }
Example #10
0
        public HttpResponseMessage GetSupplierFuelsPricesByAdmin(int adminId)
        {
            ItemsResponse <SupplierFuelsPrices> response = new ItemsResponse <SupplierFuelsPrices>();

            response.Items = SupplierFuelsPricesService.GetSupplierFuelsPricesByAdminClientID(adminId);
            return(Request.CreateResponse(response));
        }
Example #11
0
        public ActionResult <ItemsResponse <List <int> > > GetTotalUsers()
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                List <int> totalCount = _userService.GetTotalUsers();
                if (totalCount == null)
                {
                    code     = 404;
                    response = new ErrorResponse("App Resource not found");
                }
                else
                {
                    response = new ItemsResponse <int> {
                        Items = totalCount
                    };
                }
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse(ex.Message);
            }
            return(StatusCode(code, response));
        }
Example #12
0
        public HttpResponseMessage GetSupplierFuelPricesByICAO(int adminId, string icao)
        {
            ItemsResponse <SupplierFuelsPrices> response = new ItemsResponse <SupplierFuelsPrices>();

            response.Items = SupplierFuelsPricesService.GetSupplierFuelsPricesByICAO(adminId, icao);
            return(Request.CreateResponse(response));
        }
Example #13
0
        public HttpResponseMessage GetListOfSupplierFuelsPrices()
        {
            ItemsResponse <SupplierFuelsPrices> response = new ItemsResponse <SupplierFuelsPrices>();

            response.Items = SupplierFuelsPricesService.GetListOfSupplierFuelsPrices();
            return(Request.CreateResponse(response));
        }
        public HttpResponseMessage ListCat()
        {
            ItemsResponse<Domain.Categories> response = new ItemsResponse<Domain.Categories>();
            response.Items = CategorieService.ListCategories();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetCustomerFields(int contactId)
        {
            ItemsResponse <ContactDetailCustomFields> response = new ItemsResponse <ContactDetailCustomFields>();

            response.Items = ContactDetailCustomFieldsService.GetCustomFields(contactId);
            return(Request.CreateResponse(response));
        }
Example #16
0
        public ActionResult <ItemsResponse <List <FAQ> > > SelectAll()
        {
            BaseResponse response = null;
            int          code     = 200;

            try
            {
                List <FAQ> faqList = _service.GetAll();
                if (faqList == null)
                {
                    code     = 404;
                    response = new ErrorResponse("Records Not Found");
                }
                else
                {
                    response = new ItemsResponse <FAQ> {
                        Items = faqList
                    };
                }
            }
            catch (Exception ex)

            {
                code     = 500;
                response = new ErrorResponse(ex.Message);
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }
Example #17
0
        public ActionResult <ItemsResponse <Pizzas> > GetPizzaAndTopping()
        {
            ItemsResponse <Pizzas> response = null;
            ActionResult           result   = null;

            try
            {
                List <Pizzas> pizzas = _pizzaService.GetPizzaAndTopping();
                if (pizzas == null)
                {
                    result = NotFound();
                }
                else
                {
                    response       = new ItemsResponse <Pizzas>();
                    response.Items = pizzas;
                    result         = Ok(response);
                }
            }
            catch (Exception ex)
            {
                result = StatusCode(500, new ErrorResponse(ex.Message));
            }

            return(result);
        }
        public HttpResponseMessage GetByName(SchoolTypeAheadRequestName idModel)
        {
            if (idModel == null)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.NotAcceptable,
                           "No data was sent to the server."));
            }
            ;

            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.BadRequest,
                           ModelState));
            }
            ;

            List <SchoolTypeAheadRequest> eventmodel = schooltypeAheadService.GetByName(idModel);

            ItemsResponse <SchoolTypeAheadRequest> itemsResponse = new ItemsResponse <SchoolTypeAheadRequest>();

            itemsResponse.Items = eventmodel;

            return(Request.CreateResponse(HttpStatusCode.OK, itemsResponse));
        }
Example #19
0
        public void Success()
        {
            Console.WriteLine("Success Start");
            var JsonString = File.ReadAllText("../../../Files/GetItems.txt");
            var Client     = MockGenerator.MockRestClient <ItemsResponse>(HttpStatusCode.OK, JsonString);
            HacarusVisualInspection VisualInspection = new HacarusVisualInspection(Client);
            ItemsResponse           Response         = VisualInspection.GetItems();

            Assert.IsNotNull(Response);
            Assert.IsNotNull(Response.HttpResponse);
            Assert.IsNotNull(Response.Data);
            Assert.IsNull(Response.Errors);
            Assert.IsTrue(Response.HttpResponse.StatusCode.Equals(HttpStatusCode.OK));
            Assert.IsTrue(Response.Data.Archived.Count.Equals(0));
            Assert.IsTrue(Response.Data.Predict.Count.Equals(1));
            Assert.IsTrue(Response.Data.Training.Count.Equals(1));

            //Summary
            Assert.IsNotNull(Response.Data.Summary);
            Assert.IsTrue(Response.Data.Summary.Adjusted.Equals(0));
            Assert.IsTrue(Response.Data.Summary.Analysed.Equals(0));
            Assert.IsTrue(Response.Data.Summary.ArchivedDefects.Equals(0));
            Assert.IsTrue(Response.Data.Summary.Assessment.Equals("Bad Product"));
            Assert.IsTrue(Response.Data.Summary.Confirmed.Equals(0));
            Assert.IsTrue(Response.Data.Summary.DefectsDetected.Equals(0));
            Assert.IsTrue(Response.Data.Summary.DetectionAccuracy.Equals(0));
            Assert.IsTrue(Response.Data.Summary.ItemsArchived.Equals(0));
            Assert.IsTrue(Response.Data.Summary.ItemsForReview.Equals(0));
            Assert.IsTrue(Response.Data.Summary.Title.Equals("Context #1"));
            Assert.IsTrue(Response.Data.Summary.Training.Good.Equals(1));
            Assert.IsTrue(Response.Data.Summary.Training.Defect.Equals(0));
            Console.WriteLine("Success End");
        }
        public HttpResponseMessage GetListOfFuelOrderTaxes(int fuelOrderId)
        {
            ItemsResponse <FuelOrderTaxes> response = new ItemsResponse <FuelOrderTaxes>();

            response.Items = FuelOrderTaxesService.GetListOfFuelOrderTaxes(fuelOrderId);
            return(Request.CreateResponse(response));
        }
        public HttpResponseMessage SelectAllByBlog(int id)
        {
            ItemsResponse <BlogComment> res = new ItemsResponse <BlogComment>();

            res.Items = BlogCommentService.SelectAll(id);
            return(Request.CreateResponse(HttpStatusCode.OK, res));
        }
        public async Task <HttpResponseMessage> Upload()
        {
            if (!Request.Content.IsMimeMultipartContent())
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
            var filesReadToProvider = await Request.Content.ReadAsMultipartAsync();

            List <string> urls = new List <string>();

            int userId = User.Identity.GetId().Value;

            foreach (var stream in filesReadToProvider.Contents)
            {
                var fileBytes = await stream.ReadAsByteArrayAsync();

                var contentType = stream.Headers.ContentType.MediaType;
                var url         = amazonUploader.Upload(userId, contentType, fileBytes);
                urls.Add(url);
            }

            ItemsResponse <string> itemsResponse = new ItemsResponse <string>();

            itemsResponse.Items = urls;
            return(Request.CreateResponse(HttpStatusCode.Created, value: itemsResponse));
        }
Example #23
0
        public HttpResponseMessage GetAll()
        {
            ItemsResponse <HomeStatistic> response = new ItemsResponse <HomeStatistic>();

            response.Items = _homeStatisticsService.SelectAll();
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Example #24
0
        public async Task <IActionResult> Upload(List <IFormFile> files)
        {
            ObjectResult result = null;

            try
            {
                List <FileResponse> urlList = await _service.Upload(files, _config.Domain, _config.AccessKey, _config.Secret);

                ItemsResponse <FileResponse> response = new ItemsResponse <FileResponse>()
                {
                    Items = urlList
                };

                result = StatusCode(201, response);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                ErrorResponse response = new ErrorResponse(ex.Message);

                result = StatusCode(500, response);
            }

            return(result);
        }
Example #25
0
        public HttpResponseMessage SelectAll()
        {
            ItemsResponse <ProjectPersonStatus> response = new ItemsResponse <ProjectPersonStatus>();

            response.Items = ProjectPersonStatusService.SelectAll();
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public HttpResponseMessage GetFBOVendorExclusion(int custId, int fboId)
        {
            ItemsResponse <FBODetailVendorExclusions> response = new ItemsResponse <FBODetailVendorExclusions>();

            response.Items = FBODetailVendorExclusionsService.GetExclusionsByCustClient(custId, fboId);
            return(Request.CreateResponse(response));
        }
        public HttpResponseMessage GetVendorExclusion(int custId, int adminId)
        {
            ItemsResponse <CustomerDetailVendorExclusions> response = new ItemsResponse <CustomerDetailVendorExclusions>();

            response.Items = CustomerDetailVendorExclusionsService.GetExclusionsByCustClient(custId, adminId);
            return(Request.CreateResponse(response));
        }
        public HttpResponseMessage GetFuelQuote(PartnerServiceIntegrationGetQuoteRequest model)
        {
            if (!CheckAccount(model))
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, badResponse));
            }

            FuelOrderPricingsCollection quotes = new FuelOrderPricingsCollection();

            foreach (string ICAO in model.ICAO.Split(','))
            {
                FuelOrderPricingsCollection quote = new FuelOrderPricingsCollection();

                if (ICAO != "")
                {
                    quotes.AddRange(FuelOrderPricingsService.GetQuoteForLocation(model.AdminClientID, model.CustClientID,
                                                                                 ICAO, model.TailNumber));
                }
            }

            ItemsResponse <FuelOrderPricings> response = new ItemsResponse <FuelOrderPricings>();

            response.Items = quotes;
            return(Request.CreateResponse(response));
        }
Example #29
0
        public ActionResult <ItemsResponse <Post> > GetPosts()
        {
            ActionResult         result   = null;
            ItemsResponse <Post> response = null;

            try
            {
                List <Post> postList = _postService.GetPosts();

                if (postList != null)
                {
                    response       = new ItemsResponse <Post>();
                    response.Items = postList;
                    result         = Ok(response.Items);
                }
                else
                {
                    result = NotFound(new ErrorResponse("404 not found."));
                }
            }
            catch (Exception ex)
            {
                result = StatusCode(500, new ErrorResponse(ex.Message.ToString()));
            }

            return(result);
        }
Example #30
0
        public ActionResult <ItemsResponse <FAQ> > SelectAllCategories()
        {
            int code = 200;

            BaseResponse response = null;

            try
            {
                List <FAQCategories> catList = _service.GetCategories();

                if (catList == null)
                {
                    code     = 404;
                    response = new ErrorResponse("Records not found");
                }
                else
                {
                    response = new ItemsResponse <FAQCategories> {
                        Items = catList
                    };
                }
            }
            catch (Exception ex)
            {
                code     = 500;
                response = new ErrorResponse(ex.Message);
                base.Logger.LogError(ex.ToString());
            }

            return(StatusCode(code, response));
        }
Example #31
0
        public void SuccessPredictGoodStatus()
        {
            Console.WriteLine("SuccessPredictGoodStatus Start");
            var JsonString = File.ReadAllText("../../../Files/GetItems.txt");
            var Client     = MockGenerator.MockRestClient <ItemsResponse>(HttpStatusCode.OK, JsonString);
            HacarusVisualInspection VisualInspection = new HacarusVisualInspection(Client);
            ItemsResponse           Response         = VisualInspection.GetItems();

            Assert.IsTrue(Response.Data.Predict[0].Assessment.Equals("Upload specific status"));
            Assert.IsFalse(Response.Data.Predict[0].ConfirmedAssessment);
            Assert.IsTrue(Response.Data.Predict[0].Date.Equals(DateTime.Parse("Wed, 19 Jun 2019 05:03:09 GMT").ToUniversalTime()));
            Assert.IsTrue(Response.Data.Predict[0].DefaultImage.Equals("https://hacarus-saas-data.s3.amazonaws.com/raw/bc8a33dde2b0f45e2d6340083b5e153f59e33a42"));
            Assert.IsNull(Response.Data.Predict[0].Description);
            Assert.IsTrue(Response.Data.Predict[0].DetectedObjects.Equals(0));
            Assert.IsTrue(Response.Data.Predict[0].DetectionAccuracy.Equals(0));
            Assert.IsTrue(Response.Data.Predict[0].FinishedDate.Equals(DateTime.Parse("Wed, 19 Jun 2019 07:24:42 GMT").ToUniversalTime()));
            Assert.IsTrue((bool)Response.Data.Predict[0].Good);
            Assert.IsFalse(Response.Data.Predict[0].IsTrainingData);
            Assert.IsTrue(Response.Data.Predict[0].ItemId.Equals("0001"));
            Assert.IsTrue(Response.Data.Predict[0].Label.Equals("Job id is 0001"));
            Assert.IsTrue(Response.Data.Predict[0].OverrideAssessment);
            Assert.IsTrue(Response.Data.Predict[0].Status.Equals("done"));
            Assert.IsTrue(Response.Data.Predict[0].ThumbnailImage.Equals("https://hacarus-saas-data.s3.amazonaws.com/thumbnail/bc8a33dde2b0f45e2d6340083b5e153f59e33a42"));
            Console.WriteLine("SuccessPredictGoodStatus End");
        }
        public HttpResponseMessage GetFaqs()
        {
            ItemsResponse<FAQ> response = new ItemsResponse<FAQ>();

            response.Items = FaqsService.GetFaqs();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetByType(Int16 type)
        {
            ItemsResponse<BudgetBox> response = new ItemsResponse<BudgetBox>();

            response.Items = _budgetBoxService.SelectByType(type);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetByType(int typeId)
        {
            ItemsResponse<Referral> response = new ItemsResponse<Referral>();

            response.Items = _referralService.GetByPartnerType(typeId);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetAllReferrals()
        {
            ItemsResponse<Referral> response = new ItemsResponse<Referral>();

            response.Items = _referralService.Get();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetAllAddresses()
        {
            ItemsResponse<Address> response = new ItemsResponse<Address>();

            response.Items = _addressesService.GetAllAddresses();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetAll()
        {
            ItemsResponse<QAndA> response = new ItemsResponse<QAndA>();

            response.Items = _qAndAService.GetAll();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetPageMetaTag(int ownerId, int ownerType)
        {
            ItemsResponse<PageMetaTag> response = new ItemsResponse<PageMetaTag>();

            response.Items = _metaTagsService.GetPageMT(ownerId, ownerType);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetByOwner(int ownerId, int ownerType)
        {
            ItemsResponse<SiteLink> response = new ItemsResponse<SiteLink>();

            response.Items = _siteLinksService.GetByOwner(ownerId, ownerType);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage Get()
        {
            ItemsResponse<Tags> response = new ItemsResponse<Tags>();

            response.Items = _tagsService.Get();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage Get()
        {
            ItemsResponse<Event> response = new ItemsResponse<Event>();

            response.Items = _eventsService.Get();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetMetaTag()
        {
            ItemsResponse<MetaTag> response = new ItemsResponse<MetaTag>();

            response.Items = _metaTagsService.GetMT();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage Get()
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            ItemsResponse<UserSettings> response = new ItemsResponse<UserSettings>();
            response.Items = UserService.GetSettings();
            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetByDate()
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            ItemsResponse<OfficeHour> response = new ItemsResponse<OfficeHour>();
            response.Items =_officeHours.GetByDate();
            return Request.CreateResponse(response);
        }
        public HttpResponseMessage Get()
        {
            HttpResponseMessage result = null;

            ItemsResponse<Media> imageList = new ItemsResponse<Media>();
            imageList.Items = _MediaService.GetPictureByCurrentUser();

            result = Request.CreateResponse(HttpStatusCode.OK, imageList);

            return result;
        }
        public HttpResponseMessage GetUserFinancials(int planId)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            ItemsResponse<PlanFeatureProg> response = new ItemsResponse<PlanFeatureProg>();
            string userId = _userService.GetCurrentUserId();
            response.Items = _plansProgressService.GetFeaturesByPlan(planId, userId);
            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetAll()
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            ItemsResponse<Ethnicities> response = new ItemsResponse<Ethnicities>();

            response.Items = _ethnicitiesService.GetAll();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetPlanTypes()
        {
            ItemsResponse<PlanType> response = new ItemsResponse<PlanType>();

            response.Items = _plansService.GetPlanTypes();

            if (response == null)
            {
                ErrorResponse er = new ErrorResponse("NOPE, NADA, YOU FAIL!");
                return Request.CreateResponse(HttpStatusCode.BadRequest, er);
            }

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetMembers()
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
            // List < ChatMember > Members = null;

            ItemsResponse<ChatMember> response = new ItemsResponse<ChatMember>();

            response.Items = _chatService.GetMembers();

            return Request.CreateResponse(response);
        }
 public HttpResponseMessage UploadToAws(int fileType)
 {
     var httpRequest = HttpContext.Current.Request;
     try
     {
         ItemsResponse<File> response = new ItemsResponse<File>();
         response.Items = _filesService.ProcessFiles(httpRequest, fileType);
         return Request.CreateResponse(response);
     }
     catch (AmazonS3Exception s3Exception)
     {
         return Request.CreateResponse(HttpStatusCode.BadRequest, s3Exception);
     }
 }
        public HttpResponseMessage GetConversation(string Handle)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            string userId = _userService.GetCurrentUserId();
            string receiverID = _userService.GetUserIdByHandle(Handle);

            ChatCommentAddRequest comment = new ChatCommentAddRequest();
            comment.ReceiverHandle = receiverID;

            int id = _chatService.GetConversationId(receiverID, userId);

            ItemsResponse<UserComment> response = new ItemsResponse<UserComment>();

            response.Items = _commentService.Select(id, 12);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetAllUsers()
        {
            ItemsResponse<User> response = new ItemsResponse<User>();

            response.Items = _userService.GetAll();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetPeople()
        {
            ItemsResponse<TestPerson> response = new ItemsResponse<TestPerson>();

            response.Items = TestService.Get(false);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage SelectByOwnerIdOwnerType(int OwnerId, int OwnerType)
        {
            ItemsResponse<UserComment> response = new ItemsResponse<UserComment>();

            response.Items = _commentService.Select(OwnerId, OwnerType);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage SelectByParentId(int ParentId)
        {
            ItemsResponse<UserComment> response = new ItemsResponse<UserComment>();

            response.Items = _commentService.Select(ParentId);

            return Request.CreateResponse(response);
        }
Example #56
0
        public HttpResponseMessage GetList(int ownerId, int ownerTypeId, int parentId = 0)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            ItemsResponse<Comment> response = new ItemsResponse<Comment>();

            response.Items = _commentsService.GetList(ownerId, ownerTypeId, parentId);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetsUsers()
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            ItemsResponse<UserInfo> response = new ItemsResponse<UserInfo>();

            response.Items = _userDataService.GetsList();

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetAllUsersByEmailConfirmed(bool EmailConfirmed)
        {
            ItemsResponse<User> response = new ItemsResponse<User>();

            response.Items = _userService.GetAllByEmailConfirm(EmailConfirmed);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetProfilePics()
        {
            ItemsResponse<File> response = new ItemsResponse<File>();

            string userId = _userService.GetCurrentUserId();

            response.Items = _userService.GetProfilePictures(userId);

            return Request.CreateResponse(response);
        }
        public HttpResponseMessage GetAllUsersByStatus(int status)
        {
            ItemsResponse<User> response = new ItemsResponse<User>();

            response.Items = _userService.GetAllByStatus(status);

            return Request.CreateResponse(response);
        }