示例#1
0
        public async Task DeletePicture(ChadderPicture picture)
        {
            var record = await sqlDB.GetPicture(picture.RecordId);

            await sqlDB.DeleteAsync(record);

            Pictures.Remove(picture);
        }
        public ChadderPicture GetPicture(string id)
        {
            if (id == null)
            {
                if (DefaultPicture == null)
                {
                    DefaultPicture = new ChadderPicture(Source);
                }
                return(DefaultPicture);
            }
            var picture = Pictures.FirstOrDefault(i => i.Id == id);

            if (picture == null)
            {
                picture = new ChadderPicture(Source)
                {
                    Id = id,
                };
                Pictures.Add(picture);
            }
            return(picture);
        }