Beispiel #1
0
 public bool DeletePerson(int personID)
 {
     try {
         var updatePerson = PersonsRepository.Get().Where(m => m.Id == personID).FirstOrDefault();
         updatePerson.IsDeleted = true;
         if (PersonsRepository.Update(updatePerson) != null)
         {
             return(true);
         }
         return(false);
     }catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #2
0
        public void Add_test()
        {
            //Arrange

            Person person = new Person
            {
                FirstName = "Dawid",
                LastName  = "Borycki",
                Age       = 34,
                Email     = "*****@*****.**"
            };

            //Act

            _persons.Add(person);
            bool result = _persons.Get().Contains(person);

            //Assert

            Assert.IsTrue(result);
        }
Beispiel #3
0
        public List <PersonModel> FindPerson(string pattern)
        {
            var persons = PersonsRepository.Get().Where(m => ((m.FirstName + " " + m.LastName).Contains(pattern) || m.PIN.Contains(pattern)) && m.IsDeleted != true).ToList();

            return(persons.Select(m => Core.Transformer.AsViewModel(m)).ToList());
        }
Beispiel #4
0
        public List <PersonModel> GetPersons()
        {
            var data = PersonsRepository.Get().Where(m => m.IsDeleted == false).ToList();

            return(data.Select(m => Core.Transformer.AsViewModel(m)).ToList());
        }
Beispiel #5
0
 public PersonModel GetPersonByID(int id)
 {
     return(Core.Transformer.AsViewModel(PersonsRepository.Get().Where(m => m.Id == id).FirstOrDefault()));
 }
 public Persons Get(string id)
 {
     return(ipersonsRepository.Get(id));
 }