Beispiel #1
0
        public void SetActiveCountry(Guid accountId, SetActiveCountryIM im)
        {
            var model = MongoDBHelper.FindSingleIndex <AccountActiveCountry>(item => item.AccountId == accountId);

            if (model == null)
            {
                MongoDBHelper.AddSignleObject(new AccountActiveCountry()
                {
                    _id        = ObjectId.GenerateNewId(),
                    AccountId  = accountId,
                    CountryId  = im.CountryId,
                    Country_CN = im.Country_CN,
                    Country_EN = im.Country_EN,
                    CreateTime = DateTime.Now,
                    UpdateTime = DateTime.Now,
                });
            }
            else
            {
                MongoDBHelper.ReplaceOne <AccountActiveCountry>(item => item.AccountId == accountId,
                                                                new AccountActiveCountry()
                {
                    _id        = model._id,
                    AccountId  = model.AccountId,
                    CountryId  = im.CountryId,
                    Country_CN = im.Country_CN,
                    Country_EN = im.Country_EN,
                    CreateTime = model.CreateTime,
                    UpdateTime = DateTime.Now
                });
            }
        }
 public ServiceResult <bool> SetActiveCountry(SetActiveCountryIM im)
 {
     new UserAccountComponent().SetActiveCountry(this.GetUser().Id, im);
     return(new ServiceResult <bool>()
     {
         Data = true
     });
 }