Ejemplo n.º 1
0
        public RegesteredPersonResult FetchAllUsers()
        {
            List <Person>          AllPersons = new List <Person>();
            RegesteredPersonResult result     = new RegesteredPersonResult();

            try
            {
                using (KodinetDbContext GetPersonContext = new KodinetDbContext())
                {
                    AllPersons = GetPersonContext.Person
                                 .ToList <Person>();
                }

                return(new RegesteredPersonResult()
                {
                    person = AllPersons,
                    Message = "Success",
                    StatusCode = 200
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        //public RegesteredPersonResult GetPerson(string Id)
        //{
        //    Person dbFingerPrint = new Person();
        //    try
        //    {


        //            using (var dbContext = new KodinetDbContext())
        //            {
        //                dbFingerPrint = dbContext.Person
        //                    .Where(b =>b.IdNumber ==Id)
        //                    .FirstOrDefault();

        //            }

        //        if (dbFingerPrint == null)
        //        {
        //            return new RegesteredPersonResult()
        //            {
        //                StatusCode = (int)HttpStatusCode.NoContent,
        //                OnePerson = dbFingerPrint,
        //                Message = HttpStatusCode.NoContent.ToString()
        //            };
        //        }


        //    }
        //    catch (Exception)
        //    {

        //    }
        //    return new RegesteredPersonResult() {
        //        StatusCode = (int)HttpStatusCode.OK,
        //        OnePerson = dbFingerPrint,
        //        Message = HttpStatusCode.OK.ToString()
        //    };
        //}

        public Person GetPerson(string Id)
        {
            Models.Person registeredPersonResult = null;
            try
            {
                using (var dbContext = new KodinetDbContext())
                {
                    registeredPersonResult = dbContext.Person
                                             .Where(b => b.IdNumber.Equals(Id))
                                             .FirstOrDefault();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(registeredPersonResult);
        }