public async Task <ObjectResultModule> UpdateCollectConsultation([FromBody] CollectConsultation input)
        {
            if (!Commons.CheckSecret(input.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var query  = await _collectConsultationService.CollectConsultationByID(input.Id);

            if (query != null && query.CreatedBy == userid)
            {
                query.ConsultID = input.ConsultID;

                query.DoctorID = input.DoctorID;

                query.ModifyOn = DateTime.Now;
                query.ModifyBy = userid;
                var res = await _collectConsultationService.UpdateCollectConsultation(query);

                this.ObjectResultModule.Object     = res;
                this.ObjectResultModule.Message    = "sucess";
                this.ObjectResultModule.StatusCode = 200;
            }
            else
            {
                this.ObjectResultModule.Message    = "NotFound";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Object     = "";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "UpdateCollectConsultation",
                OperContent = JsonHelper.ToJson(input),
                OperType    = "UpdateCollectConsultation",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }
        public async Task <ObjectResultModule> CollectConsultation([FromBody] CollectConsultation input)
        {
            if (!Commons.CheckSecret(input.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var doctor = await _yaeherDoctorService.YaeherDoctorByUserID(userid);

            if (doctor == null)
            {
                return(new ObjectResultModule("", 204, "NoContent"));
            }
            var consolutation = _consultationService.YaeherConsultationByID(input.ConsultID);

            if (consolutation == null)
            {
                return(new ObjectResultModule("", 204, "NoContent"));
            }
            var collect = await this._collectConsultationService.CollectConsultationByExpression(t => t.CreatedBy == userid && t.ConsultID == input.ConsultID);

            if (collect != null)
            {
                if (!collect.IsDelete)
                {
                    collect.IsDelete   = true;
                    collect.DeleteBy   = userid;
                    collect.DeleteTime = DateTime.Now;
                    var res = await _collectConsultationService.UpdateCollectConsultation(collect);

                    this.ObjectResultModule.Message = "uncollect success";
                }
                else
                {
                    collect.IsDelete = false;
                    collect.DeleteBy = 0;
                    var res = await _collectConsultationService.UpdateCollectConsultation(collect);

                    this.ObjectResultModule.Message = "collect success";
                }

                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                var create = new CollectConsultation()
                {
                    DoctorID  = doctor.Id,
                    ConsultID = input.ConsultID,
                    CreatedBy = userid,
                    CreatedOn = DateTime.Now
                };
                var res = await _collectConsultationService.CreateCollectConsultation(create);

                if (res.Id > 0)
                {
                    this.ObjectResultModule.StatusCode = 200;
                    this.ObjectResultModule.Message    = "collect sucess";
                    this.ObjectResultModule.Object     = res;
                }
                else
                {
                    this.ObjectResultModule.Object     = "";
                    this.ObjectResultModule.StatusCode = 400;
                    this.ObjectResultModule.Message    = "error!";
                }
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "CollectConsultation",
                OperContent = JsonHelper.ToJson(input),
                OperType    = "CollectConsultation",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion

            return(this.ObjectResultModule);
        }
        public async Task <CollectConsultation> CreateCollectConsultation(CollectConsultation DoctorFileApplyInfo)
        {
            DoctorFileApplyInfo.Id = await _repository.InsertAndGetIdAsync(DoctorFileApplyInfo);

            return(DoctorFileApplyInfo);
        }
 public async Task <CollectConsultation> UpdateCollectConsultation(CollectConsultation DoctorFileApplyInfo)
 {
     return(await _repository.UpdateAsync(DoctorFileApplyInfo));
 }
 public async Task <CollectConsultation> DeleteCollectConsultation(CollectConsultation Consultation)
 {
     return(await _repository.UpdateAsync(Consultation));
 }