Exemplo n.º 1
0
 public void Update(long uid, string title, string content, string url, string image, string position, int order)
 {
     ExceptionHelper.ThrowIfNotId(uid, "uid");
     _LazyAdvertisement.Value.position = (position ?? String.Empty).Trim();
     _LazyAdvertisement.Value.image    = (image ?? String.Empty).Trim();
     _LazyAdvertisement.Value.title    = (title ?? String.Empty).Trim();
     _LazyAdvertisement.Value.url      = (url ?? String.Empty).Trim();
     _LazyAdvertisement.Value.content  = content;
     _LazyAdvertisement.Value.updated  = DateTime.Now;
     _LazyAdvertisement.Value.updater  = uid;
     _LazyAdvertisement.Value.orderBy  = order;
     _AdvertisementRepository.SaveChanges();
 }
Exemplo n.º 2
0
        public IAdvertisementService Add(string title, string content, string url, long creater, string image, string position, int order)
        {
            ExceptionHelper.ThrowIfNotId(creater, "creater");
            ExceptionHelper.ThrowIfNullOrEmpty(position, "position", "请输入广告位置");

            var entity = new Data.Advertisement
            {
                clickCount = 0,
                position   = position.Trim(),
                isEnabled  = true,
                content    = (content ?? String.Empty).Trim(),
                created    = DateTime.Now,
                creater    = creater,
                image      = (image ?? String.Empty).Trim(),
                title      = (title ?? String.Empty).Trim(),
                updated    = DateTime.Now,
                updater    = creater,
                orderBy    = order,
                url        = (url ?? string.Empty).Trim(),
            };

            _AdvertisementRepository.Add(entity);
            _AdvertisementRepository.SaveChanges();
            return(CreateService(entity.aid));
        }