Exemplo n.º 1
0
 public static User CreateAnonymous(String IPAddress)
 {
     User user = new User();
     user.UserName = Guid.NewGuid().ToString();
     user.EmailOrIPAddress = IPAddress;
     return EntityMappingContext.Current.Users.Add(user);
 }
Exemplo n.º 2
0
 public static User Create(String userName, String emailAddress)
 {
     User user = new User();
     user.UserName = userName;
     user.EmailOrIPAddress = emailAddress;
     return EntityMappingContext.Current.Users.Add(user);
 }
Exemplo n.º 3
0
        public ActionResult Create(User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(user);
        }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 public IEnumerable<EditOperation> GetUsersOpenEditOperations(User user)
 {
     return EntityMappingContext.Current.EditOperations.Where(_ => _.IsClosed == false && _.Document == this && _.User == user);
 }
Exemplo n.º 7
0
        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");
        }
Exemplo n.º 8
0
 public ActionResult Edit(User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(user);
 }
Exemplo n.º 9
0
 internal void ReceiveHunks(Document document, User user, int clientUpdateStamp, int serverUpdateStamp, Hunk[] hunks)
 {
     DocumentEditStateCollection documentEditStates = DataStoreClient.Get();
     DocumentEditState documentEditState = documentEditStates[document];
 }