示例#1
0
        public async Task <IHttpActionResult> PostHike(HikeModel hike)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ObjectParameter output = new ObjectParameter("responseMessage", typeof(string));

            db.PR_CreateHike(hike.Name, hike.StartDate, hike.EndDate, hike.Route, hike.Photo, hike.District, hike.QualityLevel, hike.PriceLevel, hike.Difficulty, hike.HikeType, hike.StartPoint, hike.EndPoint, output);
            var r = new LoginResult()
            {
                Success = false, Msg = output.Value.ToString()
            };

            if (output.Value.ToString().Equals("Success"))
            {
                r.Success = true;
            }

            return(Ok(r));
        }