public ActionResult Delete(CultureTextIndexModel model, int[] ids) { if (ids != null && ids.Length > 0) { foreach (var cultureText in MaintDbContext.CultureTexts.Where(x => ids.Contains(x.CultureTextId)).ToList()) { MaintDbContext.CultureTexts.Remove(cultureText); } MaintDbContext.SaveChanges(); _maintDomainService.ClearCultureTextsCache(); } return Template(model.CreateTemplate(ControllerContext)); }
public ActionResult Export(CultureTextIndexModel model, int[] ids) { var db = MaintDbContext; var culture = db.Cultures.FirstOrDefault(x => x.CultureId == (int?)model.Culture); if (culture == null) { throw new Exception("请先设置语言"); } var cultureTexts = db.CultureTexts.Where(x => x.CultureId == (int?)model.Culture && x.Text != null); var obj = cultureTexts.ToList().ToDictionary(x => x.Name, x => x.Text); var text = JsonConvert.SerializeObject(obj); return File(Encoding.UTF8.GetBytes(text), "text/plain", culture.Name + ".lang"); }
public ActionResult Index(CultureTextIndexModel model) { return Template(model.CreateTemplate(ControllerContext)); }