Beispiel #1
0
        //Save LHMS Watch Request Data
        public dynamic SaveLHMSWatchRequestData(LHMSWATCHREQ Objdata)
        {
            dynamic obj = new ExpandoObject();

            try
            {
                string strtdate  = Convert.ToDateTime(Objdata.start_date).ToString("yyyy-MM-dd").ToString();
                string enddate   = Convert.ToDateTime(Objdata.end_date).ToString("yyyy-MM-dd").ToString();
                string starttime = Convert.ToDateTime(Objdata.start_time).ToString("HH:mm:ss").ToString();
                string endtime   = Convert.ToDateTime(Objdata.end_time).ToString("HH:mm:ss").ToString();

                Objdata.start_date = strtdate + " " + starttime;
                Objdata.end_date   = enddate + " " + endtime;

                var ObjData = LHMSPostData("http://appolice.co.in/lhms/api/v1/addWatchRequest", Objdata);
                return(JsonConvert.DeserializeObject <dynamic>(ObjData));
            }
            catch (Exception ex)
            {
                obj.success = false;
                obj.message = CommonSPHel.ThirdpartyMessage;
                string mappath   = HttpContext.Current.Server.MapPath("HomeExceptionLogs");
                Task   WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_Log_Exception(mappath, "SaveLHMSWatchRequestData:" + ex.Message.ToString()));

                throw ex;
            }
        }
        public IHttpActionResult SaveLHMSWatchRequestData(dynamic data)
        {
            string jsondata = token_gen.Authorize_aesdecrpty(data);

            //string jsondata = JsonConvert.SerializeObject(data);
            try
            {
                LHMSWATCHREQ val = JsonConvert.DeserializeObject <LHMSWATCHREQ>(jsondata);
                return(Ok(_lhms.SaveLHMSWatchRequestData(val)));
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }