public ActionResult AddDeceaseType(hmisDeceaseTypeMaster DeceaseTypeObject)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                var Token = "";
                if (Session != null)
                {
                    if (Session["AuthUserToken"] != null)
                    {
                        Token = Session["AuthUserToken"].ToString();
                    }
                }
                GlobalVarriables.WebApiClient.DefaultRequestHeaders.Clear();
                GlobalVarriables.WebApiClient.DefaultRequestHeaders.Add("Token", Token);
                HttpResponseMessage response1 = GlobalVarriables.WebApiClient.PostAsJsonAsync("DeceaseType", DeceaseTypeObject).Result;
                if (response1.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var EmpResponse = response1.Content.ReadAsStringAsync().Result;
                    var readTask    = response1.Content.ReadAsAsync <IList <UserEntity> >();
                    // var Users = JsonConvert.DeserializeObject<List<UserEntity>>(EmpResponse);
                    GlobalVarriables.WebApiClient.DefaultRequestHeaders.Add("Token", "1");
                }
            }
            return(View());
        }
示例#2
0
        public HttpResponseMessage Post([FromBody] hmisDeceaseTypeMaster hmisDeseaseTypeMaster)
        {
            var createResult = _deceaseTypeService.CreateDeceaseType(hmisDeseaseTypeMaster);

            if (createResult.Length > 0)
            {
                string[] returnData = createResult.ToString().Split(':');
                hmisDeseaseTypeMaster.ID = new Guid(returnData[0].ToString());
            }
            return(Request.CreateResponse(HttpStatusCode.OK, hmisDeseaseTypeMaster.ID));
        }