public void AddComment(User user, string text, int ball, Guid dish_id) { Dish dish = this.GetDish(dish_id); Comment comment = new Comment(); comment.User = user; comment.Dish = dish; comment.Text = text; comment.Date = DateTime.Now; comment.Ball = ball; dish.Comments.Add(comment); dish.Rating = this.GetRating(dish); this.Entry<Dish>(dish).State = EntityState.Modified; this.Comments.Add(comment); _IsSavedOrModified = true; }
public void AddComment(User user, string text, int ball, Guid dish_id) { _db.AddComment(user, text, ball, dish_id); }
public void UpdateAvatar(User usr, string fileName) { _db.UpdateAvatar(usr, fileName); }
public void Start(HttpContext context, IStoreDB db) { this._db = db; this._httpContext = context; HttpCookie cookie = context.Request.Cookies[COOKIE_NAME]; if (cookie != null && !string.IsNullOrEmpty(cookie.Value)) { FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value); this._user = db.GetUser(ticket.Name); if (this.User != null) this.IsAuthentication = true; else { this.DeleteCookies(); this.IsAuthentication = false; } } }
public void SetActiveCode(User usr) { _db.SetActiveCode(usr); }
public void RegisterUser(User newUser) { _db.AddUser(newUser); }
public bool GetUser(string login, out User usr) { usr = null; if (_db.IsContainUser(login)) { usr = _db.GetUser(login); return true; } return false; }
public void UpdateAvatar(User usr, string fileName) { usr.AvatarPath = fileName; this.Entry<User>(usr).State = EntityState.Modified; _IsSavedOrModified = true; }
public void SetConfirmCode(User usr) { this.Entry<User>(usr).State = EntityState.Modified; _IsSavedOrModified = true; }
public void TransferMoney(User from, User to, uint money) { from.Balnce -= (int)money; to.Balnce += (int)money; if (to.Balnce > 99999999) to.Balnce = 99999999;//Дабы при большем значении разметка ломается this.Entry<User>(from).State = EntityState.Modified; this.Entry<User>(to).State = EntityState.Modified; _IsSavedOrModified = true; }
public void SetActiveCode(User usr) { usr.IsActive = true; usr.ActivationCode = ""; this.Entry<User>(usr).State = EntityState.Modified; _IsSavedOrModified = true; }
public void RemoveUser(Guid group_id, User removeUser) { Group grp = this.GetGroup(group_id); if (grp.Users.Contains(removeUser)) { grp.Users.Remove(removeUser); this.Entry<Group>(grp).State = EntityState.Modified; _IsSavedOrModified = true; } else if (grp.Administrations.Contains(removeUser)) { grp.Administrations.Remove(removeUser); this.Entry<Group>(grp).State = EntityState.Modified; _IsSavedOrModified = true; } }
public void AddUser(User usr) { string salt = _saltDB.GetSalt(usr.Id); usr.Password = this.Encrypt(usr.Password, salt); usr.AvatarPath = "~/img/Standart/Avatar.jpg"; this.Users.Add(usr); base.SaveChanges(); }
public void AddMoney(User usr, uint addMoney) { usr.Balnce += (int)addMoney; if (usr.Balnce > 99999999) usr.Balnce = 99999999;//Дабы при большем значении разметка ломается this.Entry<User>(usr).State = EntityState.Modified; _IsSavedOrModified = true; }
public void AddMemberInGroup(Guid group_id, User usr) { Group updateGrp = this.GetGroup(group_id); if (!updateGrp.Users.Contains(usr)) { updateGrp.Users.Add(usr); this.Entry<Group>(updateGrp).State = EntityState.Modified; this._IsSavedOrModified = true; } }