Beispiel #1
0
        public void Save(Artist artist)
        {
            if (artist.Id > 0)
            {
                _db.Artist.Attach(artist);
                _db.Entry(artist).State = EntityState.Modified;
                _db.SaveChanges();
                return;
            }

            _db.Artist.Add(artist);
            _db.SaveChanges();
        }
Beispiel #2
0
        public ActionResult Login(Artist artist)
        {
            artist = ArtistRepository.CheckPassword(artist);
            if (artist == null) return View();

            FormsAuthentication.SetAuthCookie(artist.Id.ToString(), false);
            return RedirectToAction("Albums", "Album");
        }
Beispiel #3
0
 public ActionResult AddArtist(Artist artist)
 {
     ArtistRepository.Save(artist);
     return RedirectToAction("Artists");
 }
Beispiel #4
0
 public Artist CheckPassword(Artist artist)
 {
     return _db.Artist.SingleOrDefault(x => x.Name == artist.Name && x.Password == artist.Password);
 }
Beispiel #5
0
        // -------------------- Artist Region --------------------
        public ActionResult AddArtist(long? id)
        {
            var model = new Artist();
            if (id.HasValue)
            {
                model = ArtistRepository.Get(id.Value);
            }

            return View(model);
        }