コード例 #1
0
        // POST: api/Doctor
        public HttpResponseMessage Post([FromBody] hmisDoctorMaster doctorEntity)
        {
            var createResult = _doctorService.CreateDoctor(doctorEntity);

            if (createResult.Length > 0)
            {
                string[] returnData = createResult.ToString().Split(':');
                doctorEntity.ID = new Guid(returnData[0].ToString());
            }
            return(Request.CreateResponse(HttpStatusCode.OK, doctorEntity.ID));
        }
コード例 #2
0
        public ActionResult AddDoctor(hmisDoctorMaster doctorObject)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                var Token = "";
                if (Session != null)
                {
                    if (Session["AuthUserToken"] != null)
                    {
                        Token = Session["AuthUserToken"].ToString();
                    }
                }
                string departmentType = Request.Form["DepartmentType"].ToString();
                string department     = Request.Form["Department"].ToString();

                doctorObject.department_id   = new Guid(department);
                doctorObject.department_type = new Guid(departmentType);

                GlobalVarriables.WebApiClient.DefaultRequestHeaders.Clear();
                GlobalVarriables.WebApiClient.DefaultRequestHeaders.Add("Token", Token);
                HttpResponseMessage response1 = GlobalVarriables.WebApiClient.PostAsJsonAsync("Doctor", doctorObject).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);

                    ViewBag.department     = GetDepartment();
                    ViewBag.departmentType = GetDepartmentTypes();
                }
            }
            return(View());
        }