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); } }
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); }
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()); }
public List <PersonModel> GetPersons() { var data = PersonsRepository.Get().Where(m => m.IsDeleted == false).ToList(); return(data.Select(m => Core.Transformer.AsViewModel(m)).ToList()); }
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)); }