#100 adding SongOrder field
This commit is contained in:
parent
ca54d32fe4
commit
149b40d854
2214
RMuseum/Migrations/20210325070335_PoemMusicTrackSongOrder.Designer.cs
generated
Normal file
2214
RMuseum/Migrations/20210325070335_PoemMusicTrackSongOrder.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
RMuseum/Migrations/20210325070335_PoemMusicTrackSongOrder.cs
Normal file
23
RMuseum/Migrations/20210325070335_PoemMusicTrackSongOrder.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class PoemMusicTrackSongOrder : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "SongOrder",
|
||||
table: "GanjoorPoemMusicTracks",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SongOrder",
|
||||
table: "GanjoorPoemMusicTracks");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -691,6 +691,9 @@ namespace RMuseum.Migrations
|
||||
b.Property<int?>("SingerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SongOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("SuggestedById")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
||||
@ -131,5 +131,10 @@ namespace RMuseum.Models.Ganjoor
|
||||
/// rejection cause
|
||||
/// </summary>
|
||||
public string RejectionCause { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Song Order
|
||||
/// </summary>
|
||||
public int SongOrder { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -4257,6 +4257,11 @@
|
||||
rejection cause
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.SongOrder">
|
||||
<summary>
|
||||
Song Order
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.Ganjoor.PoemMusicTrackType">
|
||||
<summary>
|
||||
poem music track type
|
||||
|
||||
@ -443,7 +443,7 @@ namespace RMuseum.Services.Implementation
|
||||
{
|
||||
connection.Open();
|
||||
using (MySqlDataAdapter src = new MySqlDataAdapter(
|
||||
"SELECT poem_id, artist_name, artist_beeptunesurl, album_name, album_beeptunesurl, track_name, track_beeptunesurl, ptrack_typeid FROM ganja_ptracks ORDER BY id",
|
||||
"SELECT id, poem_id, artist_name, artist_beeptunesurl, album_name, album_beeptunesurl, track_name, track_beeptunesurl, ptrack_typeid FROM ganja_ptracks ORDER BY id",
|
||||
connection))
|
||||
{
|
||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"{jobName} - mysql")).Result;
|
||||
@ -467,7 +467,8 @@ namespace RMuseum.Services.Implementation
|
||||
TrackUrl = row["track_beeptunesurl"].ToString(),
|
||||
ApprovalDate = DateTime.Now,
|
||||
Description = "",
|
||||
Approved = approved
|
||||
Approved = approved,
|
||||
SongOrder = int.Parse(row["id"].ToString())
|
||||
};
|
||||
|
||||
var poem = await context.GanjoorPoems.Where(p => p.Id == track.PoemId).SingleOrDefaultAsync();
|
||||
@ -505,12 +506,14 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
context.GanjoorPoemMusicTracks.Add(track);
|
||||
|
||||
await context.SaveChangesAsync(); //preserve order of poems
|
||||
|
||||
|
||||
}
|
||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"{jobName} - finalizing approved poem songs data")).Result;
|
||||
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1271,7 +1271,7 @@ namespace RMuseum.Services.Implementation
|
||||
&&
|
||||
(trackType == PoemMusicTrackType.All || t.TrackType == trackType)
|
||||
)
|
||||
.OrderBy(t => t.Id)
|
||||
.OrderBy(t => t.SongOrder)
|
||||
.Select
|
||||
(
|
||||
t => new PoemMusicTrackViewModel()
|
||||
@ -1375,6 +1375,9 @@ namespace RMuseum.Services.Implementation
|
||||
sug
|
||||
);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
sug.SongOrder = sug.Id;
|
||||
_context.GanjoorPoemMusicTracks.Update(sug);
|
||||
await _context.SaveChangesAsync();
|
||||
song.Id = sug.Id;
|
||||
return new RServiceResult<PoemMusicTrackViewModel>(song);
|
||||
@ -1564,6 +1567,11 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
track.SongOrder = track.Id;
|
||||
song.Id = track.Id;
|
||||
_context.GanjoorPoemMusicTracks.Update(track);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return new RServiceResult<PoemMusicTrackViewModel>(song);
|
||||
}
|
||||
catch (Exception exp)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user