コード例 #1
0
        public async Task <IHttpActionResult> Get(Guid id)
        {
            ResponseModel <FamilyHistoryViewModel> Response = null;
            FamilyHistoryViewModel ReturnObject             = null;

            if (!id.Equals(null))
            {
                FamilyHistory DBData = _iFamilyHistoryService.GetFamilyHistoryByID(id.ToString(), ref ErrorMessage);
                if (DBData != null)
                {
                    ReturnObject = Mapper.Map <FamilyHistory, FamilyHistoryViewModel>(DBData);
                }
            }
            else
            {
                ReturnObject = new FamilyHistoryViewModel();
            }

            Response = new ResponseModel <FamilyHistoryViewModel>()
            {
                Response            = ReturnObject,
                Message             = ErrorMessage,
                ResponseCode        = HttpContext.Current.Response.StatusCode,
                ResponseDescription = HttpContext.Current.Response.StatusDescription,
                SubStatusCode       = HttpContext.Current.Response.SubStatusCode
            };
            return(await Task.FromResult(Content((HttpStatusCode)Response.ResponseCode, Response)));
        }
コード例 #2
0
        /// <summary>
        /// Accesses the get patient family history.
        /// </summary>
        /// <param name="patientId">The patient identifier.</param>
        private void AccessGetPatientFamilyHistory(int patientId)
        {
            Patient p = db.Users.Find(patientId) as Patient; //ir buscar ao session
            FamilyHistoryViewModel viewModel;

            var list = from f in db.FamilyHistoryManagers
                       from family in db.FamilyHistories
                       where f.FamilyHistoryManager_PatientId.User_id == p.User_id &&
                       family.FamilyHistory_id == f.FamilyHistoryManagerFamilyHistoryId
                       select new
            {
                family.FamilyHistoryName,
                f.Carrier
            };

            foreach (var item in list)
            {
                viewModel = new FamilyHistoryViewModel
                {
                    Carrier           = item.Carrier,
                    FamilyHistoryName = item.FamilyHistoryName
                };

                historyList.Add(viewModel);
            }
        }
コード例 #3
0
 public HttpResponseMessage AddUpdateFamilyHistory(FamilyHistoryViewModel data)
 {
     try
     {
         ResponseCodeModel ResponseData = new ResponseCodeModel();
         FamilyHistory     DBData       = _iFamilyHistoryService.SaveFamilyHistoryDetails(data, ref ErrorMessage);
         if (DBData != null)
         {
             ResponseData.Data = DBData;
             DBData.RecordID   = Guid.NewGuid();
             return(HttpOkRequest(ResponseData));
         }
         ResponseData.Data    = null;
         ResponseData.Message = "No Record Found";
         return(HttpBadRequest(ResponseData));
     }
     catch (Exception Ex) { return(HttpResponseError(Ex)); }
 }
コード例 #4
0
 public FamilyHistory SaveFamilyHistoryDetails(FamilyHistoryViewModel data, ref string errorMessage)
 {
     try
     {
         FamilyHistory DBData = Mapper.Map <FamilyHistoryViewModel, FamilyHistory>(data);
         if (DBData.ID == 0 && DBData.RecordID.ToString() == "00000000-0000-0000-0000-000000000000")
         {
             DBData.CreatedOn = DateTime.UtcNow;
             DBData.RecordID  = Guid.NewGuid();
             familyHistoryInfoRepo.Add(DBData, ref errorMessage);
         }
         else
         {
             FamilyHistory savedData = familyHistoryInfoRepo.Get(x => x.RecordID == DBData.RecordID, ref errorMessage).FirstOrDefault();
             DBData.ID = savedData.ID; DBData.Modifiedon = DateTime.UtcNow;
             familyHistoryInfoRepo.Update(savedData, DBData, ref errorMessage);
         }
         unitOfWork.Commit();
         return(DBData);
     }
     catch (Exception Ex) { errorMessage = Ex.Message; }
     return(null);
 }