public ChampionDto CreateChampion(ChampionDto champ) { var champTemp = Mapper.Map <Champion>(champ); var result = _champRepositories.Create(champTemp); if (_champRepositories.SaveChanges() > 0) { return(Mapper.Map <ChampionDto>(result)); } return(null); }
public UserDto Create(UserDto entity) { var user = Mapper.Map <User>(entity); _userRepositories.Create(user); _userRepositories.SaveChanges(); return(entity); }
public async Task <ActionResult <TEntity> > Post(TEntity entity) { var data = await _repo.Create(entity); if (data > 0) { return(Ok("mantap")); } return(BadRequest("Create UnSuccesfull")); }
public RankDto Create(RankDto data) { var rank = Mapper.Map <Rank>(data); var result = _repoRank.Create(rank); if (_repoRank.SaveChanges() > 0) { return(Mapper.Map <RankDto>(result)); } return(null); }
public SkinDto CreateSkin(SkinDto skin) { var skinTemp = Mapper.Map <Skin>(skin); var result = _skinRepositories.Create(skinTemp); if (_skinRepositories.SaveChanges() > 0) { return(Mapper.Map <SkinDto>(result)); } return(null); }
public PageGemDto CreatePageGem(PageGemDto data) { var pg = Mapper.Map <PageGem>(data); _pageGemRepositories.Create(pg); if (_pageGemRepositories.SaveChanges() > 0) { return(data); } return(null); }
public UserRechargeHistoryDto Create(UserRechargeHistoryDto rechargeHistory) { var data = Mapper.Map <UserRechargeHistory>(rechargeHistory); var result = _rechargeRepositories.Create(data); if (_rechargeRepositories.SaveChanges() > 0) { return(Mapper.Map <UserRechargeHistoryDto>(result)); } return(null); }
public LuckyWheelHistoryDto CreateLuckyHistory(LuckyWheelHistoryDto data) { var entity = Mapper.Map <LuckyWheelHistory>(data); entity.CreatedDate = DateTime.Now; entity.UserId = data.UserId; var result = _luckyWheelHistoryRepositories.Create(entity); if (_luckyWheelHistoryRepositories.SaveChanges() > 0) { return(Mapper.Map <LuckyWheelHistoryDto>(result)); } return(null); }
public LuckyWheelItemDto CreateLuckyItem(LuckyWheelItemDto data) { var entity = Mapper.Map <LuckyWheelItem>(data); entity.CreatedDate = DateTime.Now; entity.ImageUrl = "../Images/LuckyItem/" + FileUlti.SaveFile(data.FileImage, data.ImageUrl); var result = _luckyWheelItemRepositories.Create(entity); if (_luckyWheelItemRepositories.SaveChanges() > 0) { return(Mapper.Map <LuckyWheelItemDto>(result)); } return(null); }
public UserTradingHistoryDto Create(UserTradingHistoryDto tradingHistory) { var data = Mapper.Map <UserTradingHistory>(tradingHistory); var existed = _tradingHistory.Read(a => a.AccountId == data.AccountId).Any(); if (existed) { _tradingHistory.Delete(a => a.AccountId == data.AccountId); } var result = _tradingHistory.Create(data); if (_tradingHistory.SaveChanges() > 0) { return(Mapper.Map <UserTradingHistoryDto>(result)); } return(null); }
public AccountDto Create(AccountDto entity, string champ, string skin) { var account = Mapper.Map <Account>(entity); var result = _repoAccount.Create(account); if (_repoAccount.SaveChanges() > 0) { var accountAdded = _repoAccount.ReadOne(a => a.Id == result.Id); accountAdded.Champions = ChampionForCreation(champ); accountAdded.Skins = SkinForCreation(skin); _repoAccount.SaveChanges(); return(Mapper.Map <AccountDto>(result)); } return(null); }