public string Update(Profile profile) { SsdsContainer c1 = DbContext.OpenContainer("Profile"); var p = c1.Single <Profile>(c => c.Entity.OpenId == profile.OpenId && c.Entity.IdType == profile.IdType ); if (p == null) { profile.LogOnTime = DateTime.Now; profile.RegisterTime = DateTime.Now; profile.Role = "User"; profile.Id = Guid.NewGuid().ToString(); c1.Insert(new SsdsEntity <Profile> { Id = profile.Id, Kind = "Profile", Entity = profile, }); return(profile.Id); } var newp = p.Entity; newp.Name = profile.Name; //if (profile.Name == "Öصä") // newp.Role = "Admin"; newp.NickName = profile.NickName; newp.School = profile.School; newp.SchoolDetails = profile.SchoolDetails; newp.Sex = profile.Sex; c1.Update(newp, p.Id, ConcurrencyPattern.IfNoneMatch); return(p.Id); }
public void Update(Wiki wiki) { SsdsContainer c1 = DbContext.OpenContainer("Wiki"); var m = c1.Single <Wiki>(c => c.Id == wiki.Id).Entity; m.Title = wiki.Title; m.Body = wiki.Body; c1.Update <Wiki>(m, wiki.Id, ConcurrencyPattern.Always); }
public Profile Details(string openId, string idType) { SsdsContainer c1 = DbContext.OpenContainer("Profile"); var ret = c1.Single <Profile>(c => c.Entity.IdType == idType && c.Entity.OpenId == openId); if (ret == null) { return(null); } return(ret.Entity); }
public void Update(Question question) { SsdsContainer c1 = DbContext.OpenContainer("Question"); var q = c1.Single <Question>(c => c.Id == question.Id).Entity; q.Title = question.Title; q.Body = question.Body; q.MemoryLimit = question.MemoryLimit; q.TimeLimit = question.TimeLimit; q.Test = question.Test; q.GroupId = question.GroupId; c1.Update <Question>(q, question.Id, ConcurrencyPattern.Always); }
public Group GetGroup(string id) { SsdsContainer c1 = DbContext.OpenContainer("Group"); return(c1.Single <Group>(c => c.Entity.Id == id).Entity); }
public Wiki GetById(string id) { SsdsContainer c1 = DbContext.OpenContainer("Wiki"); return(c1.Single <Wiki>(c => c.Id == id).Entity); }
public Wiki Get(string title) { SsdsContainer c1 = DbContext.OpenContainer("Wiki"); return(c1.Single <Wiki>(c => c.Entity.Title == title).Entity); }