Exemple #1
0
        public ActionResult UserProfile()
        {
            var userId = User.Claims.SingleOrDefault(x => x.Type == "UserId") != null?User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null;

            int UserId = 0;

            Int32.TryParse(userId, out UserId);

            APIJsonResult result = new APIJsonResult();

            result.Access  = true;
            result.success = true;
            var user = _context.Users.Where(x => x.Id == UserId).Include(f => f.fk_UserRoleMap).ThenInclude(g => g.UserRole).ThenInclude(p => p.fk_UserRolePermMap).ThenInclude(h => h.Permission).FirstOrDefault();

            UserProfileModel data = new UserProfileModel()
            {
                Id             = user.Id,
                Address        = user.Address,
                BirthDate      = PublicFunctions.ConvertToTimestamp(user.BirthDate.Value),
                Email          = user.Email,
                Gender         = user.Gender,
                InsuranceNo    = user.InsuranceNo,
                Name           = user.Name,
                PersonalImage  = Configuration["Doctors:Url"] + "/" + "Upload/PersonalImage/" + user.Id + "/" + user.PersonalImage,
                InsuranceImage = Configuration["Doctors:Url"] + "/" + "Upload/InsuranceImage/" + user.Id + "/" + user.InsuranceImage,
                Notes          = user.Notes,
                BloodType      = user.BloodType
            };

            result.data = data;
            return(Ok(result));
        }
Exemple #2
0
        public ActionResult GetSurgicalHistoryById([FromBody] int Id)
        {
            APIJsonResult result = new APIJsonResult();

            var userId = User.Claims.SingleOrDefault(x => x.Type == "UserId") != null?User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null;

            int UserId = 0;

            Int32.TryParse(userId, out UserId);
            if (UserId == 0)
            {
                result.success = false;
                result.Msg.Add("NoUser");
                return(Ok(result));
            }

            result.data = (from a in _PastSurgicalHistory.Where(a => a.UserId == UserId && a.Id == Id)
                           select new
            {
                a.Id,
                a.Name,
                SurgicalDate = PublicFunctions.ConvertToTimestamp(a.SurgicalDate),
                a.UserId,
                Images = (from image in _context.Set <PastSurgicalHistoryImage>().Where(f => f.SurgicalId == a.Id)
                          select new
                {
                    image = Configuration["Doctors:Url"] + "/" + "Upload/SurgicalHistory/" + UserId + "/" + image.Image,
                }).ToList()
            }).FirstOrDefault();

            return(Ok(result));
        }
Exemple #3
0
        public ActionResult DoctorList(PagingModel paging)
        {
            APIJsonResult result = new APIJsonResult();

            result.Access     = true;
            result.success    = true;
            paging.PageNumber = paging.PageNumber == 0 ? 0 : paging.PageNumber;
            paging.Count      = paging.Count == 0 ? 100 : paging.Count;
            var data = (from a in _user.Where(x => x.fk_UserRoleMap.FirstOrDefault().UserRoleId == 7)
                        select new
            {
                Id = a.Id,
                Name = a.Name,
                PersonalImage = Configuration["Doctors:Url"] + "/" + "Upload/PersonalImage/" + a.Id + "/" + a.PersonalImage,
                Email = a.Email,
                Mobile = a.Mobile,
                Address = a.Address,
                Notes = a.Notes,
                BirthDate = PublicFunctions.ConvertToTimestamp(Convert.ToDateTime(a.BirthDate)),
            }
                        ).Skip((paging.PageNumber * paging.Count)).Take(paging.Count).ToList();

            result.data = data;
            return(Ok(result));
        }
Exemple #4
0
        public ActionResult GetAllPastSurgicalHistory()
        {
            APIJsonResult result = new APIJsonResult();
            var           userId = User.Claims.SingleOrDefault(x => x.Type == "UserId") != null?User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null;

            int UserId = 0;

            Int32.TryParse(userId, out UserId);
            if (UserId == 0)
            {
                result.success = false;
                result.Msg.Add("NoUser");
                return(Ok(result));
            }
            result.success = true;
            result.Access  = true;

            result.data = (from a in _PastSurgicalHistory.Where(a => a.UserId == UserId)
                           select new
            {
                a.Id,
                a.Name,
                SurgicalDate = PublicFunctions.ConvertToTimestamp(a.SurgicalDate),
            }).ToList();
            //var data = _allergyRepository.GetAllByUserId(UserId);
            //result.data = data;
            return(Ok(result));
        }