本文整理汇总了C#中Repository.Gets方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.Gets方法的具体用法?C# Repository.Gets怎么用?C# Repository.Gets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository.Gets方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteEducation
public void DeleteEducation()
{
var repo = new Repository<EducationModel>(DbCollection.Education);
var contacts = repo.Gets().Where(m => m.UserId == "5709a5b24a549a1a9873a19b");
foreach (var item in contacts)
{
repo.Delete(item.Id);
}
}
示例2: AddCountryHelper
public static bool AddCountryHelper(CountryModel model)
{
var repo = new Repository<CountryModel>(DbCollection.Country);
if (repo.Gets().Any(m => m.Name.Equals(model.Name)))
{
return false;
}
repo.Insert(model);
return true;
}
示例3: DownloadAlonhadat
public FileResult DownloadAlonhadat()
{
var repo = new Repository<AlonhadatReport>("alonhadatreports");
var data = repo.Gets().OrderBy(i => i.Date);
var csv = new StringBuilder();
csv.AppendLine("Date,Vip1,Vip2,Vip3,Vip4,Vip5,Basic,Total");
foreach (var item in data)
{
csv.AppendLine(item.Csv);
}
return File(new System.Text.UTF8Encoding().GetBytes(csv.ToString()), "text/csv", "alonhadat.com.vn.csv");
}
示例4: Batdongsan
public JsonResult Batdongsan()
{
var repo = new Repository<BdsReport>("bdsreports");
return Json(repo.Gets().OrderBy(i => i.Date).Select(i => new
{
date = TimeZoneInfo.ConvertTimeToUtc(i.Date, TimeZoneInfo.Local).ToShortDateString() + " (" + i.Count + ")",
count = i.Count,
specialvip = i.SpecialVip,
vip1 = i.Vip1,
vip2 = i.Vip2,
vip3 = i.Vip3,
basic = i.Basic
}), JsonRequestBehavior.AllowGet);
}
示例5: Diaoconline
public JsonResult Diaoconline()
{
var repo = new Repository<DiaOcOnlineReport>("diaoconlinereports");
return Json(repo.Gets().OrderBy(i => i.Date).Select(i => new
{
date = TimeZoneInfo.ConvertTimeToUtc(i.Date, TimeZoneInfo.Local).ToShortDateString() + " (" + i.Count + ")",
count = i.Count,
vip = i.Vip,
tietkiem = i.TietKiem,
tienloi = i.TienLoi,
hieuqua = i.HieuQua,
basic = i.Basic
}), JsonRequestBehavior.AllowGet);
}
示例6: Cafeland
public JsonResult Cafeland()
{
var repo = new Repository<CafelandReport>("cafelandreports");
return Json(repo.Gets().OrderBy(i => i.Date).Select(i => new
{
date = TimeZoneInfo.ConvertTimeToUtc(i.Date, TimeZoneInfo.Local).ToShortDateString() + " (" + i.Count + ")",
count = i.Count,
supervip = i.SuperVip,
vip1 = i.Vip1,
vip2 = i.Vip2,
vip3 = i.Vip3,
basic = i.Basic
}), JsonRequestBehavior.AllowGet);
}
示例7: Alonhadat
public JsonResult Alonhadat()
{
var repo = new Repository<AlonhadatReport>("alonhadatreports");
return Json(repo.Gets().OrderBy(i => i.Date).Select(i => new
{
date = TimeZoneInfo.ConvertTimeToUtc(i.Date, TimeZoneInfo.Local).ToShortDateString() + " (" + i.Count + ")",
count = i.Count,
vip1 = i.Vip1,
vip2 = i.Vip2,
vip3 = i.Vip3,
vip4 = i.Vip4,
vip5 = i.Vip5,
basic = i.Basic
}), JsonRequestBehavior.AllowGet);
}
示例8: FixErrorDefaultData
public void FixErrorDefaultData()
{
var repo = new Repository<UserModel>(DbCollection.User);
var repoShare = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
var users = repo.Gets().ToList();
Console.WriteLine("BEGIN INSERT MISSING DATA...");
foreach (var user in users)
{
Console.WriteLine("CHECK ShareSetting: " + user.UserName);
var shareSetting = repoShare.Gets().FirstOrDefault(m => m.UserId.Equals(user.Id.ToString()));
if (shareSetting == null)
{
Console.WriteLine("BEGIN INSERT ShareSetting: " + user.UserName);
repoShare.Insert(new ShareSettingModel { UserId = user.Id.ToString() });
}
}
Console.WriteLine("DONE!!!!");
Console.ReadLine();
}
示例9: Create
public ActionResult Create(AdminSetting model)
{
try
{
var repo = new Repository<AdminSetting>(DbCollection.AdminSetting);
var item = repo.Gets().FirstOrDefault(m => m.Title.Equals(model.Title));
if (item == null)
{
model.Enable = true;
repo.Insert(model);
return RedirectToAction("Index");
}
else
{
return Json(new { result = MyConstants.Duplicate });
}
}
catch
{
return View();
}
}
示例10: TranslationMainLanguagePair
//[ValidateAntiForgeryToken]
public ActionResult TranslationMainLanguagePair(ProfileTranslationViewModel model)
{
var repo = new Repository<ProfileLanguageModel>(DbCollection.ProfileLanguage);
var listItem = repo.Gets().Where(m => m.AccountId.Equals(User.Identity.GetUserId()) && m.Type.Equals(1)).ToList();
foreach (var profileLanguageModel in listItem)
{
repo.Delete(profileLanguageModel.Id);
}
foreach (var item in model.ProfileLanguageList)
{
item.AccountId = User.Identity.GetUserId();
item.Type = 1;
repo.Insert(item);
}
if (string.IsNullOrEmpty(model.SourceOther) || string.IsNullOrEmpty(model.TargetOther))
return Json(new {result = true, model});
var other = new ProfileLanguageModel
{
AccountId = User.Identity.GetUserId(),
Type = 1,
SourceLanguage = model.SourceOther,
TargetLanguage = model.TargetOther,
};
repo.Insert(other);
return Json(new { result = true, model });
}
示例11: TranslationBestRate
public ActionResult TranslationBestRate(ProfileTranslationViewModel model)
{
var repo = new Repository<ProfileTranslationRateModel>(DbCollection.ProfileTranslationRate);
var item = repo.Gets().FirstOrDefault(m => m.Id.Equals(model.ProfileRate.Id));
if (item != null)
{
item.MinRatePerSourceWord = model.ProfileRate.MinRatePerSourceWord;
item.PreferredRatePerSourceWord = model.ProfileRate.PreferredRatePerSourceWord;
item.MinRatePerHour = model.ProfileRate.MinRatePerHour;
item.PreferredRatePerHour = model.ProfileRate.PreferredRatePerHour;
repo.Update(item);
}
else
{
item = new ProfileTranslationRateModel
{
AccountId = User.Identity.GetUserId(),
MinRatePerSourceWord = model.ProfileRate.MinRatePerSourceWord,
PreferredRatePerSourceWord = model.ProfileRate.PreferredRatePerSourceWord,
MinRatePerHour = model.ProfileRate.MinRatePerHour,
PreferredRatePerHour = model.ProfileRate.PreferredRatePerHour,
};
repo.Insert(item);
}
return Json(new { result = true, model });
}
示例12: TranslationBestRateLoad
public ActionResult TranslationBestRateLoad()
{
var repo = new Repository<ProfileTranslationRateModel>(DbCollection.ProfileTranslationRate);
var item = repo.Gets().Where(m => m.AccountId.Equals(User.Identity.GetUserId())).OrderByDescending(i => i.Id).FirstOrDefault() ??
new ProfileTranslationRateModel();
var model = new ProfileTranslationViewModel
{
ProfileRate = item
};
return PartialView("_ProfileTranslationRateLoadPartial", model);
}
示例13: TranslationTool
public ActionResult TranslationTool()
{
var repo = new Repository<ProfileToolModel>(DbCollection.ProfileTool);
var listItem = repo.Gets().Where(m => m.AccountId.Equals(User.Identity.GetUserId()) && m.Type.Equals(1) & m.ToolId != null).ToList();
var itemOrther = repo.Gets().FirstOrDefault(m => m.AccountId.Equals(User.Identity.GetUserId()) && m.Type.Equals(1) & m.Tool == null) ??
new ProfileToolModel();
var repoTool = new Repository<ToolModel>(DbCollection.Tool);
var listTool = repoTool.Gets().ToList();
var model = new ProfileTranslationViewModel
{
ProfileToolList = listItem,
ToolList = listTool,
ExpertiseOther = itemOrther.Tool
};
return PartialView("_ProfileTranslationToolPartial", model);
}
示例14: Index
// GET: SettingAdmin
public ActionResult Index()
{
var repo = new Repository<AdminSetting>(DbCollection.AdminSetting);
var listItem = repo.Gets().ToList();
return View(listItem);
}
示例15: LoadContact
public JsonResult LoadContact()
{
String searc = Request.QueryString["search[value]"];
var repo = new Repository<ContactMarkettingModel>("contactMarketting");
var datax = repo.Gets().Select(i => new
{
name = i.Name,
objecttitle = i.ObjectTitle,
tel = i.Tel,
email = i.Email,
date = i.date
});
JsonPage page=new JsonPage();
String pageindex= Request.QueryString["draw"];
int pagesize = 10;
page.recordsTotal = datax.ToList().Count;
page.recordsFiltered = datax.ToList().Count;
page.draw = int.Parse(pageindex);
String lg = Request.QueryString["length"];
String begin = Request.QueryString["start"];
datax = datax.Skip(int.Parse(begin)).Take(int.Parse(lg));
page.data = datax;
var data = Json(page, JsonRequestBehavior.AllowGet);
return data;
}