Beispiel #1
0
        public IHttpActionResult SelfEvents()
        {
            var date   = this.GetEndDate(DataType.SELFEVENT);
            var events = this.manager.GetSelfEventRiverData(date);
            var model  = ResponseModelConverter.ConvertEventModel(events);

            return(this.Ok(model));
        }
Beispiel #2
0
        public IHttpActionResult SelfTopNewList()
        {
            var date   = this.GetEndDate(DataType.SELFTOPNEWS);
            var events = this.manager.GetSelfTopNews(date);
            var model  = ResponseModelConverter.ConvertEventModel(events);

            return(this.Ok(model));
        }
        public IHttpActionResult SentimentNewsList()
        {
            var date    = this.GetEndDate(DataType.TOPSENTINEWS);
            var manager = this.GetCAmanager();
            var events  = manager.GetMostSentimentNews(date);
            var model   = ResponseModelConverter.ConvertEventModel(events);

            return(this.Ok(model));
        }
        public IHttpActionResult TopNewList()
        {
            var date    = this.GetEndDate(DataType.TOPNEWS);
            var manager = this.GetCAmanager();
            var events  = manager.GetTopCompetitorNews(date);
            var model   = ResponseModelConverter.ConvertEventModel(events);

            return(this.Ok(model));
        }
Beispiel #5
0
        public IHttpActionResult UpdoadData([FromBody][Required] List <RequestApiModel> requestApiModel)
        {
            if (ModelState.IsValid && requestApiModel != null)
            {
                List <RequestModel> requestModel = ResponseModelConverter.Convert(requestApiModel);

                Option <bool, Exception> resultOptionBool = _dataStore.SaveData(requestModel);
                bool isSucces = resultOptionBool.ValueOr(false);

                if (isSucces)
                {
                    return(Ok("Data was Updated with success."));
                }
                else
                {
                    Exception exception = resultOptionBool.ExceptionOr(() => throw new InvalidOperationException("Internal Server Error - data was not added to database."));
                    return(InternalServerError(new Exception(exception.Message)));
                }
            }
            else
            {
                return(BadRequest("Received data was incorrect or empty."));
            }
        }