Ejemplo n.º 1
0
        public HttpResponseMessage Create(Diagnosis mDiagnosis)
        {
            HttpResponseMessage response = null;

            try
            {
                if (IsAdminPermission())
                {
                    int id = diagnosisService.SaveDiagnosis(mDiagnosis);

                    if (id > 0)
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, id);
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.Forbidden, "");
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.Unauthorized);
                }
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
            return(response);
        }
        public JsonResult SaveDiagnosis(DiagnosisViewModel model)
        {
            Doctor doctor = new Doctor();

            doctor = _userService.GetDoctorByUserId(Convert.ToInt32(Session["UserId"]));
            model.Diagnosis.DoctorId = doctor.DoctorId;
            if (model.IsAdmit != false)
            {
                model.PatientAdmitDetail.DoctorId = doctor.DoctorId;
            }
            _diagnosisService.SaveDiagnosis(model);
            Token oldToken = _tokenService.GetTokenById(Convert.ToString(model.Token.TokenId));

            oldToken.StatusId = 3;
            _tokenService.UpdateToken(oldToken);
            return(new JsonResult {
                Data = new { Status = "Success", msg = "Diagnosis completed." }, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }