Esempio n. 1
0
 public ActionResult Create(Genre model)
 {
     context.Entry(model).State = System.Data.Entity.EntityState.Added;
     context.SaveChanges();
     TempData["success"] = "Tür ekleme işlemi başarıyla tamamlandı.";
     return(RedirectToAction("index"));
 }
Esempio n. 2
0
 public ActionResult Create(Artist model)
 {
     if (model.PhotoFile != null)
     {
         model.Photo = new WebImage(model.PhotoFile.InputStream).Resize(301, 301).Crop(1,1).AddTextWatermark("www.musicstore.com", opacity: 70).GetBytes("jpeg");
     }
     context.Entry(model).State = System.Data.Entity.EntityState.Added;
     context.SaveChanges();
     TempData["success"] = "Sanatçı ekleme işlemi başarıyla tamamlandı.";
     return RedirectToAction("index");
 }
Esempio n. 3
0
 public ActionResult Create(Album model)
 {
     if (model.PhotoFile != null)
     {
         model.CoverImage = new WebImage(model.PhotoFile.InputStream).Resize(601, 601).Crop(1, 1).AddTextWatermark("www.musicstore.com", fontColor: "Red", opacity: 70).GetBytes("jpeg");
     }
     model.Price = decimal.Parse(model.PriceText);
     context.Entry(model).State = System.Data.Entity.EntityState.Added;
     context.SaveChanges();
     TempData["success"] = "Albüm ekleme işlemi başarıyla tamamlandı.";
     return(RedirectToAction("index"));
 }
        public async Task <Album> Update(Album album, CancellationToken cancellationToken = default)
        {
            _dbContext.Entry(album).State = EntityState.Modified;
            await _dbContext.SaveChangesAsync(cancellationToken).ConfigureAwait(false);

            return(album);
        }
Esempio n. 5
0
        public IHttpActionResult PutSong(int id, Song song)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != song.SongId)
            {
                return(BadRequest());
            }

            db.Entry(song).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SongExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = song.SongId }, song));
        }
Esempio n. 6
0
        public IHttpActionResult PutAlbum(int id, Album album)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != album.AlbumId)
            {
                return(BadRequest());
            }

            db.Entry(album).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AlbumExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = album.AlbumId }, album));
        }
Esempio n. 7
0
 public ActionResult Edit([Bind(Include = "Id,Name,Age,PhoneNumber,Email,Address,City")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "ArtistId,Name,Bio,Origin,Picture")] Artist artist)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artist).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(artist));
 }
Esempio n. 9
0
 public ActionResult Edit([Bind(Include = "Id,StoreName,PhoneNumber,Email,Address,City")] Branch branch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(branch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(branch));
 }
Esempio n. 10
0
 public ActionResult Edit([Bind(Include = "Id,SerialNumber,Name,Artist,Genre,Year,Description,Price,BranchId,Sales")] Item item)
 {
     if (ModelState.IsValid)
     {
         db.Entry(item).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BranchId = new SelectList(db.branches, "Id", "Name", item.BranchId);
     return(View(item));
 }
Esempio n. 11
0
 public ActionResult Edit([Bind(Include = "SongId,Title,Length,AlbumId")] Song song)
 {
     if (ModelState.IsValid)
     {
         db.Entry(song).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AlbumId = new SelectList(db.Albums, "AlbumId", "Title", song.AlbumId);
     return(View(song));
 }
Esempio n. 12
0
 public ActionResult Edit([Bind(Include = "AlbumId,Title,Poster,Genre,ReleaseDate,Price,ArtistId")] Album album)
 {
     if (ModelState.IsValid)
     {
         db.Entry(album).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId);
     return(View(album));
 }
 public ActionResult Edit(Album album)
 {
     if (ModelState.IsValid)
     {
         _dbContext.Entry(album).State = EntityState.Modified;
         _dbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GenreId  = new SelectList(_dbContext.Genres, "GenreId", "Name", album.GenreId);
     ViewBag.ArtistId = new SelectList(_dbContext.Artists, "ArtistId", "Name", album.ArtistId);
     return(View(album));
 }
 public void CreateInstrument(InstrumentEntity newInstrument)
 {
     dbContext.Entry(newInstrument.Store).State = EntityState.Unchanged;
     dbContext.Instruments.Add(newInstrument);
 }
 public void Update(T obj)
 {
     table.Attach(obj);
     db.Entry(obj).State = EntityState.Modified;
 }