public static User CreateAnonymous(String IPAddress) { User user = new User(); user.UserName = Guid.NewGuid().ToString(); user.EmailOrIPAddress = IPAddress; return EntityMappingContext.Current.Users.Add(user); }
public static User Create(String userName, String emailAddress) { User user = new User(); user.UserName = userName; user.EmailOrIPAddress = emailAddress; return EntityMappingContext.Current.Users.Add(user); }
public ActionResult Create(User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return RedirectToAction("Index"); } return View(user); }
ChangeSubset GetUsersChangeSubset(User user) { ChangeSubset result = null; foreach (ChangeSubset entry in GetUsersChangeSet(user).ChangeSubsets.OrderByDescending(_ => _.Id).Take(1)) result = entry; if (result == null) { result = new ChangeSubset(SpringboardState.Create(GetCurrentActiveEdits())); GetUsersChangeSet(user).ChangeSubsets.Add(result); } return result; }
ChangeSet GetUsersChangeSet(User user) { ChangeSet result = null; foreach (ChangeSet entry in (from changeSet in ChangeSets where changeSet.Owner == user orderby changeSet.Id descending select changeSet).Take(1)) result = entry; if (result == null) { result = new ChangeSet(); user.ChangeSets.Add(result); this.ChangeSets.Add(result); } return result; }
public IEnumerable<EditOperation> GetUsersOpenEditOperations(User user) { return EntityMappingContext.Current.EditOperations.Where(_ => _.IsClosed == false && _.Document == this && _.User == user); }
public void AppendHunk(Hunk hunk, User user) { foreach (EditOperation editOperation in GetUsersOpenEditOperations(user).OrderByDescending(lambdaEditOperation => lambdaEditOperation.Hunks.Min(lambdaHunk => lambdaHunk.StartIndex))) { editOperation.MergeHunk(ref hunk); if (hunk == null) break; } if (hunk is InsertionHunk) { var operation = new InsertOperation(); GetUsersChangeSubset(user).EditOperations.Add(operation); operation.Hunks.Add(hunk); } else if (hunk is DeletionHunk) { var operation = new DeleteOperation(); GetUsersChangeSubset(user).EditOperations.Add(operation); operation.Hunks.Add(hunk); } else throw new InvalidOperationException("Cannot create No-Operation operation"); }
public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(user); }
internal void ReceiveHunks(Document document, User user, int clientUpdateStamp, int serverUpdateStamp, Hunk[] hunks) { DocumentEditStateCollection documentEditStates = DataStoreClient.Get(); DocumentEditState documentEditState = documentEditStates[document]; }