private async Task Save()
        {
            ContactModel model = ContactFake.Update(_id, Name, Email, IsFavorite);

            MessagingCenter.Send(model, "UpdateList");
            await NavigationHelper.GetInstance().GoBack();
        }
        public ContactDetailViewModel(string id)
        {
            _id = id;
            ContactModel model = ContactFake.GetById(id);

            Name       = model.Name;
            Email      = model.Email;
            IsFavorite = model.IsFavorite;
        }
Ejemplo n.º 3
0
        public ContactViewModel()
        {
            Data = new ObservableCollection <ContactModel>(ContactFake.GetAll());

            MessagingCenter.Subscribe(this, "UpdateList", async(ContactModel model) =>
            {
                System.Diagnostics.Debug.WriteLine("Updating list...");
                int index = Data.IndexOf(model);

                //The below lines is an workaround for Android.
                Data.RemoveAt(index);
                await Task.Delay(100);
                Data.Insert(index, model);
            });
        }
Ejemplo n.º 4
0
        public void ShouldRequireValidSkills()
        {
            var entity     = new Developer(_faker.Random.Long(), _faker.Person.Email, _faker.Person.FullName, null, 0, ContactFake.Build(), AddressFake.Build(), null, null);
            var validation = entity.Validate();

            validation.Should().BeFalse();
            entity.Errors.Should().NotBeNullOrEmpty();
            entity.Errors.Should().Contain("Skills is required");
        }