public void Accept(string profileId) { var userId = User.Identity.GetUserId(); DbContext.Pairings.Add(new Pairing { UserId = userId, PairedUser = profileId, Paired = true, MatchedOn = DateTime.Now }); DbContext.SaveChanges(); }
public ActionResult Save(List <long> selectedObjects) { var userId = User.Identity.GetUserId(); var oldSkills = Dbcontext.skills_list.Where(x => x.UserId == userId).ToList(); foreach (var skill in oldSkills) { Dbcontext.skills_list.Remove(skill); } Dbcontext.SaveChanges(); foreach (var skill in selectedObjects) { Dbcontext.skills_list.Add(new skills_list { UserId = userId, SkillId = skill }); } Dbcontext.SaveChanges(); return(RedirectToAction("Index")); }