public ActionResult AddDeparetmentType(hmisDepartmentTypeMaster DepartmentTypeObject)
        {
            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("DepartmentType", DepartmentTypeObject).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());
        }
Example #2
0
        public HttpResponseMessage Post([FromBody] hmisDepartmentTypeMaster hmisDepartmentTypeMaster)
        {
            var createResult = _departmentTypeService.CreateDepartmentType(hmisDepartmentTypeMaster);

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