Esempio n. 1
0
        public async Task <IActionResult> AddHealthAsync(string userId, HealthAddViewModel model)
        {
            if (userId != User.FindFirst(ClaimTypes.NameIdentifier).Value || User.FindFirst(ClaimTypes.Role).Value == EnumRoles.ORGANIZER)
            {
                return(Unauthorized());
            }

            var healthDto = _mapper.Map <HealthDto>(model);

            healthDto = await _healthRepository.AddHealthAsync(userId, healthDto);

            if (healthDto != null)
            {
                return(CreatedAtRoute("GetHealthUser", new { userId = userId }, healthDto));
            }

            return(BadRequest());
        }
Esempio n. 2
0
        public ActionResult HealthInsert(HealthAddViewModel model)
        {
            HealthDto healthDto = new HealthDto();

            healthDto.HealthUserId = int.Parse(Request.Form["HealthUserId"].ToString());
            healthDto.HealthXuexing = Request.Form["HealthXuexing"].ToString();
            healthDto.HealthRH = Request.Form["HealthRH"].ToString();
            healthDto.HealthFeiyong = Request.Form["HealthFeiyong"].ToString();
            if (String.IsNullOrEmpty(Request.Form["HealthGuomin"]))
            {
                healthDto.HealthGuomin = "无";

            }
            else
            {
                healthDto.HealthGuomin = Request.Form["HealthGuomin"].ToString();
            }
            if (String.IsNullOrEmpty(Request.Form["HealthBaolou"]))
            {
                healthDto.HealthBaolou = "无";

            }

            else
            {
                healthDto.HealthBaolou = Request.Form["HealthBaolou"].ToString();
            }
            if (String.IsNullOrEmpty(Request.Form["HealthJibing"]))
            {
                healthDto.HealthJibing = "无";

            }
            else
            {
                healthDto.HealthJibing = Request.Form["HealthJibing"].ToString();

            }
            healthDto.HealthShoushu = Request.Form["HealthShoushu"].ToString();
            healthDto.HealthWaishang = Request.Form["HealthWaishang"].ToString();
            healthDto.HealthShuxue = Request.Form["HealthShuxue"].ToString();
            if (String.IsNullOrEmpty(Request.Form["HealthJiazuDady"]))
            {

                healthDto.HealthJiazuDady = "无";
            }
            else
            {
                healthDto.HealthJiazuDady = Request.Form["HealthJiazuDady"].ToString();
            }

            if (String.IsNullOrEmpty(Request.Form["HealthJiazuMama"]))
            {
                healthDto.HealthJiazuMama = "无";

            }
            else
            {
                healthDto.HealthJiazuMama = Request.Form["HealthJiazuMama"].ToString();
            }

            if (String.IsNullOrEmpty(Request.Form["HealthJiazuXiongdi"]))
            {

                healthDto.HealthJiazuXiongdi = "无";
            }
            else
            {
                healthDto.HealthJiazuXiongdi = Request.Form["HealthJiazuXiongdi"].ToString();

            }
            if (String.IsNullOrEmpty(Request.Form["HealthJiazuZinv"]))
            {
                healthDto.HealthJiazuZinv = "无";

            }
            else
            {
                healthDto.HealthJiazuZinv = Request.Form["HealthJiazuZinv"].ToString();
            }

            healthDto.HealthYichuan = Request.Form["HealthYichuan"].ToString();
            if (String.IsNullOrEmpty(Request.Form["HealthCanji"]))
            {

                healthDto.HealthCanji = "无";

            }
            else
            {
                healthDto.HealthCanji = Request.Form["HealthCanji"].ToString();
            }

            healthDto.HealthChufang = Request.Form["HealthChufang"].ToString();
            healthDto.HealthRanliao = Request.Form["HealthRanliao"].ToString();
            healthDto.HealthYinshui = Request.Form["HealthYinshui"].ToString();
            healthDto.HealthCesuo = Request.Form["HealthCesuo"].ToString();
            healthDto.HealthQichulan = Request.Form["HealthQichulan"].ToString();

            HealthBll.AddHealth(healthDto);

             //   return RedirectTo("/Health/HealthIndex", "客户身体信息添加成功了");
            //return RedirectToAction("HealthIndex");
            return RedirectToAction("UserIndex", "User", new { groupId = 0, userClass = 0, doctorId = System.Web.HttpContext.Current.Request.Cookies["DoctorId"].Value });
        }