public async Task <ObjectResultModule> CreateYaeherPatientCollection([FromBody] YaeherPatientCollection 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 create = new YaeherPatientCollection() { UserID = input.UserID, Opentype = input.Opentype, CollectionType = input.CollectionType, CollectionUrl = input.CollectionUrl, CollectionJSON = input.CollectionJSON, CreatedBy = userid, CreatedOn = DateTime.Now }; var res = await _PatientCollectionService.CreateYaeherPatientCollection(create); if (res.Id > 0) { this.ObjectResultModule.StatusCode = 200; this.ObjectResultModule.Message = "sucess"; this.ObjectResultModule.Object = res; } else { this.ObjectResultModule.Object = ""; this.ObjectResultModule.StatusCode = 400; this.ObjectResultModule.Message = "error!"; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "CreateYaeherPatientCollection", OperContent = JsonHelper.ToJson(input), OperType = "CreateYaeherPatientCollection", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(this.ObjectResultModule); }
public async Task <ObjectResultModule> UpdateYaeherPatientCollection([FromBody] YaeherPatientCollection 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 _PatientCollectionService.YaeherPatientCollectionByID(input.Id); if (query != null) { query.UserID = input.UserID; query.Opentype = input.Opentype; query.CollectionType = input.CollectionType; query.CollectionUrl = input.CollectionUrl; query.CollectionJSON = input.CollectionJSON; query.ModifyOn = DateTime.Now; query.ModifyBy = userid; var res = await _PatientCollectionService.UpdateYaeherPatientCollection(query); this.ObjectResultModule.Message = "success"; this.ObjectResultModule.StatusCode = 200; this.ObjectResultModule.Object = res; } else { this.ObjectResultModule.StatusCode = 404; this.ObjectResultModule.Message = "NotFound"; this.ObjectResultModule.Object = ""; } #region 操作日志 var CreateYaeherOperList = new YaeherOperList() { OperExplain = "UpdateYaeherPatientCollection", OperContent = JsonHelper.ToJson(input), OperType = "UpdateYaeherPatientCollection", CreatedBy = userid, CreatedOn = DateTime.Now }; var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList); #endregion return(this.ObjectResultModule); }