Exemplo n.º 1
0
        public int CreateAlbum(CreateAlbumModel model)
        {
            try
            {
                using (var context = new sparrow_dbEntities())
                {
                    var album = new SPRW_ALBUM()
                    {
                        ARTIST_ID          = model.ArtistId,
                        RELEASE_DATE       = model.ReleaseDate,
                        NAME               = model.AlbumName,
                        DESCRP             = model.Description,
                        LAST_MAINT_USER_ID = "",
                        LAST_MAINT_TIME    = DateTime.Now
                    };
                    context.SPRW_ALBUM.Add(album);
                    context.SaveChanges();

                    return(album.ALBUM_ID);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 2
0
        public int CreateAlbum(ModifyAlbumModel model)
        {
            try
            {
                using (var context = new SparrowMusicEntities())
                {
                    var album = new SPRW_ALBUM()
                    {
                        ARTIST_ID = model.ArtistId,
                        RELEASE_DATE = model.ReleaseDate,
                        NAME = model.AlbumName,
                        DESCRP = model.Description,
                        LAST_MAINT_USER_ID = "",
                        LAST_MAINT_TIME = DateTime.Now
                    };
                    context.SPRW_ALBUM.Add(album);
                    context.SaveChanges();

                    return album.ALBUM_ID;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }