public async Task<DarumaView> CreateDaruma(string wish, DarumaWishTheme theme)
 {
     var daruma = new DarumaDomain(wish, theme);
     //TODO: need another way handle exception
     bool result = await _storage.Add(daruma);
     if(!result)
     {
         throw new NullReferenceException("can't add daruma(((");
     }
     return new DarumaView(daruma, _imageUriResolver);
 }
Beispiel #2
0
        //public void ChangeStatus(DarumaStatus status)
        //{
        //    if (Status == status)
        //    {
        //        return;
        //    }
        //    ImageUri = _uriResolver.ResolveImageUri(status);
        //    Status = status;
        //}
        public DarumaView(DarumaDomain daruma, IDarumaImageUriResolver uriResolver)
        {
            if (daruma == null)
            {
                throw new  ArgumentException("daruma");
            }

            if (uriResolver == null)
            {
                throw new ArgumentException("uriResolver");
            }

            //_uriResolver = uriResolver;
            Id = daruma.Id;
            Wish = daruma.Wish;
            Theme = daruma.Theme;
            CreateDate = daruma.CreateDate;
            Status = daruma.Status;
            ImageUri = uriResolver.ResolveImageUri(daruma.Status);
            CurrentQuoteKey = daruma.CurrentQuoteKey;
        }