Exemplo n.º 1
0
 public static BaseResponseMessage Validate(RequestBoats request)
 {
     #region Validation HeaderRequest
     BaseResponseMessage resp = new BaseResponseMessage();
     resp.header = new ResponseHeader();
     if (request.Header.ApiKey != CommonDefinitions.APIKEY)
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.API_KEY_NOT_MATCH;
     }
     else if (request.Header.Device == 0)
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.DEVICE_INFORMATION_NOT_FOUND;
     }
     else if (String.IsNullOrEmpty(request.Header.RequestId))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.REQUEST_ID_NOT_FOUND;
     }
     else
     {
         resp.header.IsSuccess       = true;
         resp.header.ResponseCode    = CommonDefinitions.SUCCESS;
         resp.header.ResponseMessage = CommonDefinitions.SUCCESS_MESSAGE;
     }
     #endregion
     return(resp);
 }
Exemplo n.º 2
0
        public async Task <BaseResponseMessage> BoatService(RequestBoats request)
        {
            BoatOperation op = new BoatOperation(request, this.boatsService);

            op.Execute();

            return(op.response);
        }
Exemplo n.º 3
0
        public async Task <BaseResponseMessage> BoatService([FromBody] JObject json)
        {
            string jsonRequest = json.ToString();

            RequestBoats request = new RequestBoats();

            request = JsonConvert.DeserializeObject <RequestBoats>(jsonRequest);
            return(await this.repository.BoatService(request));
        }
Exemplo n.º 4
0
        public async Task <List <ResponseBoats> > PopularBoatsService([FromBody] JObject json)
        {
            string       jsonRequest = json.ToString();
            RequestBoats request     = new RequestBoats();

            request = JsonConvert.DeserializeObject <RequestBoats>(jsonRequest);

            return(await this.repository.GetPopularBoatService(request));
        }
Exemplo n.º 5
0
        public static List <ResponseBoats> GetPopularBoats(RequestBoats request)
        {
            BaseResponseMessage baseResponseMessage = new BaseResponseMessage();

            //Validate Reques Header / Constants
            baseResponseMessage = Validate(request);
            if (!baseResponseMessage.header.IsSuccess)
            {
                throw new Exception(baseResponseMessage.header.ResponseMessage);
            }

            Boats boat = null;
            List <ResponseBoats>        _favorite     = new List <ResponseBoats>();
            List <ResponsePopularBoats> respFavorites = new List <ResponsePopularBoats>();

            _favorite = favoritesServices.SelectPopularBoats();

            return(_favorite);
        }
Exemplo n.º 6
0
        public void GetPopularBoats()
        {
            RequestBoats req = new RequestBoats
            {
                Header = new Header
                {
                    Device         = (int)DeviceEnum.Device.WEB,
                    OperationTypes = (int)OperationType.OperationTypes.UPDATE,
                    RequestId      = Guid.NewGuid().ToString(),
                    ApiKey         = "U6l1hKzpZDrgfTaKxpQm3A/6raDiroAI7ueTgMNwhQs=",
                    TokenId        = ""
                }
            };

            List <ResponseBoats> listFavorites = new List <ResponseBoats>();

            listFavorites = CommonServices.GetPopularBoats(req);

            Assert.IsNotNull(listFavorites);
            Assert.IsTrue((listFavorites.Count > 0 ? true : false));
        }
Exemplo n.º 7
0
        public void BoatOperation()
        {
            BoatsService service     = new BoatsService();
            RequestBoats requestBoat = new RequestBoats
            {
                BOAT_ID       = 3,
                BOAT_INFO     = "TestBoat3",
                CAPTAIN_ID    = 1,
                FLAG          = "TR",
                BOAT_NAME     = "TestBoat3",
                INSERT_USER   = "******",
                QUANTITY      = 14,
                ROTA_INFO     = "testRota3",
                UPDATE_USER   = "******",
                PRICE         = "50",
                PRIVATE_PRICE = "150",
                REGION_ID     = 2,
                TOUR_TYPE     = Enum.GetName(typeof(Enums.TourType), 1),

                Header = new Header
                {
                    Device         = (int)DeviceEnum.Device.WEB,
                    OperationTypes = (int)OperationType.OperationTypes.UPDATE,
                    RequestId      = Guid.NewGuid().ToString(),
                    ApiKey         = "U6l1hKzpZDrgfTaKxpQm3A/6raDiroAI7ueTgMNwhQs=",
                    TokenId        = ""
                }
            };

            BoatOperation bb = new BoatOperation(requestBoat, service);

            bb.Execute();

            Assert.IsNotNull(bb.response);
            Assert.IsTrue(bb.response.header.IsSuccess == true);
        }
Exemplo n.º 8
0
 public BoatOperation(RequestBoats request)
 {
     this.request.Header = new Header();
     this.request        = request;
 }
Exemplo n.º 9
0
 public BoatOperation(RequestBoats request, BoatsService service)
 {
     this.request.Header = new Header();
     this.request        = request;
     this.boatsService   = service;
 }
Exemplo n.º 10
0
 public async Task <List <ResponseBoats> > GetPopularBoatService(RequestBoats request)
 {
     //ToDo:
     //Kişiye özel popular secimler gelmeli
     return(this.favoritesServices.SelectPopularBoats());
 }