Esempio n. 1
0
        public async Task <IHttpActionResult> Post([FromBody] ListCityLanguage valCity)
        {
            string    vResult   = "4";
            ICityData vCityData = new CityData();

            try {
                vResult = await vCityData.Insert(valCity);

                if (vResult == "1" && !string.IsNullOrEmpty(vResult))
                {
                    return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, new { code = HttpStatusCode.OK, Message = Messages.vOkInserted, Result = vResult })));
                }
            } catch (Exception vEx) {
                string vMessage = vEx.Message;
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, new { code = HttpStatusCode.InternalServerError, Message = Messages.vInternalServerError, Result = vResult })));
            }
            return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotAcceptable, new { code = HttpStatusCode.NotAcceptable, Message = Messages.vNotInserted, Result = vResult })));
        }