public void Delete(User user) { foreach (Presentation presentation in dataContext.Presentations) { if (presentation.UserId == user.Id) { Delete(presentation); } } Update(user); }
public List<Presentation> VotedByMe(User user) { List<Presentation> list = new List<Presentation>(); foreach (Vote vote in dataContext.Votes) { if (vote.UserId == user.Id) list.Add(GetPresentationById(vote.PresentationId)); } return list; }
public void Update(User user) { User baseUser = GetUserById(user.Id); baseUser.IsActive = false; dataContext.SubmitChanges(); }
public void ValidateRegistration(User user) { User baseUser = GetUserById(user.Id); baseUser.IsActive = true; dataContext.SubmitChanges(); }
public List<Presentation> Search(User user) { List<Presentation> resultList1 = new List<Presentation>(); foreach (Presentation presentation in dataContext.Presentations) { if (presentation.UserId == user.Id && presentation.IsActive == true) { resultList1.Add(presentation); } } return resultList1; }
public void SendCode(User user) { MailMessage message = new MailMessage(); message.To.Add(user.Email); MailAddress MA = new MailAddress("*****@*****.**"); message.From = MA; message.Subject = "Registration"; int? v = user.ValidationCode; message.Body = "Your validation code is " + v.ToString(); SmtpClient client = new SmtpClient("smtp.rambler.ru"); client.Port = 25; client.Credentials = new NetworkCredential("*****@*****.**", "a14881488"); client.Send(message); }
public void RegistrateUser(string Name, string Password, string City, int Age) { User user = new User(); user.Name = Name; user.Password = Password; user.City = City; user.Age = Age; user.IsActive = false; Random rand = new Random(); user.ValidationCode = rand.Next(10000); Add(user); }
public void Add(User user) { user.Id = dataContext.Users.Count() + 1; dataContext.Users.InsertOnSubmit(user); dataContext.SubmitChanges(); }
private void detach_Users(User entity) { this.SendPropertyChanging(); entity.Role = null; }
private void attach_Users(User entity) { this.SendPropertyChanging(); entity.Role = this; }
partial void DeleteUser(User instance);
partial void UpdateUser(User instance);
partial void InsertUser(User instance);