public ActionResult ViewNotation()
 {
     List<Notation> notations = new List<Notation>();
     using (var db = new EntityModel())
     {
         notations = db.Notations.ToList();
     }
     return View(notations);
 }
 public void SetInformationHeader(string id, string header)
 {
     using (var db = new EntityModel())
     {
         var information = db.Information.Find(Convert.ToInt32(id));
         if (information != null)
             information.Header = header;
         db.SaveChanges();
     }
 }
 public string GetInformationHeader(string id)
 {
     using (var db = new EntityModel())
     {
         var information = db.Information.Find(Convert.ToInt32(id));
         if (information != null)
             return information.Header;
         else return String.Empty;
     }
 }
 public ActionResult RemoveNotation(string id)
 {
     using (var db = new EntityModel())
     {
         var notation = db.Notations.Find(Convert.ToInt32(id));
         if (notation != null)
             db.Notations.Remove(notation);
         db.SaveChanges();
     }
     return RedirectToAction("ViewNotation");
 }
 public void AddNotation(string name,string number)
 {
     using (var db = new EntityModel())
     {
         Notation newNotation = new Notation();
         newNotation.Name = name;
         newNotation.PhoneNumber = number;
         db.Notations.Add(newNotation);
         db.SaveChanges();
     }
 }
 public void SetInformationBody(string id, string bodyText)
 {
     using (var db = new EntityModel())
     {
         bodyText = bodyText.Replace("#%^", "<").Replace("#&*", ">");
         var information = db.Information.Find(Convert.ToInt32(id));
         if (information != null)
             information.Body = bodyText;
         db.SaveChanges();
     }
 }
 public ActionResult Login(LoginModel model)
 {
     if (ModelState.IsValid)
     {
         using (var db = new EntityModel())
         {
             var users =
                 db.Users.Where(x => x.UserName == model.Name)
                     .Where(x => x.Password == model.Password)
                     .ToList();
             if (users.Count > 0)
             {
                 FormsAuthentication.SetAuthCookie(model.Name, false);
                 return RedirectToAction("Index", "Home");
             }
         }
     }
     ModelState.AddModelError("", "Неверное имя пользователя или пароль.");
     return View(model);
 }