public string WriteLogMessage(string str) { var ctx = new LogEntities(); Int32 id = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; var l = ctx.Set<Log>(); l.Add( new Log { Id = id, Application = "DIMvc4", Message = str }); ctx.SaveChanges(); return "write Hello World! " + str; }
public string GetLogMessage() { string entry; using (var ctx = new LogEntities()) { entry = (from m in ctx.Logs where m.Application == "DIMvc4" orderby m.Id descending select m.Message).FirstOrDefault(); } return "Hello World! " + entry; }
public ActionResult AssignReviewer(int?paperId) { if (paperId == null) { return(HttpNotFound()); } var reviewers = db.Reviewers.ToList(); //list all reviewers var paper = db.Papers.Find(paperId); //list paper Checkboxlist checklist = new Checkboxlist { paper = paper,//first is checkboxlist's paper, second is "var paper" get paper checklist = new List <Checkbox>(), }; foreach (var reviewer in reviewers) //show all reviewers find in "var reviewers" { var checkbox = new Checkbox //build checkbox { IsSelected = false, //intial state isn't be selected reviewerId = reviewer.reviewerId, }; User user1 = db.Users.Find(reviewer.reviewerId);//ba shang mian de reviewer de id qu user li mian zhao if (user1 != null) { checkbox.name = user1.name; } LogEntities db2 = new LogEntities(); AspNetUser user2 = db2.AspNetUsers.Find(reviewer.reviewerId); if (user2 != null) { checkbox.Email = user2.Email; } var keywordbrgs = db.Reviewers.Where(m => m.reviewerId == reviewer.reviewerId).ToList(); foreach (var keywordbrg in keywordbrgs) { var keywordEntity = db.Keywords.Find(keywordbrg.keywords); checkbox.keyword += keywordEntity.keyword1 + ", "; } checklist.checklist.Add(checkbox);//1 is "Checkboxlist checklist = new Checkboxlist" }//2 is checklist class's attribute return(View(checklist)); }
private async void ConnectMethod() { LogEntities.Clear(); log.LogInformation("Инициализация мультиплексора"); await Multiplexor.Start(); }