Beispiel #1
0
        // POST: api/Tour
        public IHttpActionResult Post([FromBody] ActivitySearch valFilter)
        {
            string        vResult       = "3";
            IActivityData vActivityData = new ActivityData();

            try {
                bool vNullField = VerifyNullFiledsSearch(valFilter);

                if (vNullField)
                {
                    vResult = "1";
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, new { Code = HttpStatusCode.NotAcceptable, Message = Messages.vListContainNullValue, Result = vResult })));
                }
                string vResponse = vActivityData.SelectByTour(valFilter);

                if (!string.IsNullOrEmpty(vResponse))
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, new { Code = HttpStatusCode.OK, Message = Messages.vOkListed, Result = vResponse })));
                }
                vResult = "2";
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, new { Code = HttpStatusCode.NoContent, Message = Messages.vNotListed, Result = vResult })));
            } catch (Exception) {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, new { Code = HttpStatusCode.BadRequest, Message = Messages.vInternalServerError, Result = vResult })));
            }
        }