привязка и прочая фигня
This commit is contained in:
parent
b0cf340079
commit
933b919e68
@ -15,5 +15,7 @@ namespace TravelAgencyContracts.BindingModels
|
|||||||
public int GuideId { get; set; }
|
public int GuideId { get; set; }
|
||||||
|
|
||||||
public Dictionary<int, ITourModel> ExcursionGroupTours { get; set; } = new();
|
public Dictionary<int, ITourModel> ExcursionGroupTours { get; set; } = new();
|
||||||
|
|
||||||
|
public Dictionary<int, IPlaceModel> ExcursionGroupPlaces { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,5 +21,7 @@ namespace TravelAgencyContracts.ViewModels
|
|||||||
public string? GuideFIO { get; set; } = string.Empty;
|
public string? GuideFIO { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Dictionary<int, ITourModel> ExcursionGroupTours { get; set; } = new();
|
public Dictionary<int, ITourModel> ExcursionGroupTours { get; set; } = new();
|
||||||
|
|
||||||
|
public Dictionary<int, IPlaceModel> ExcursionGroupPlaces { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,7 @@
|
|||||||
int GuideId { get; }
|
int GuideId { get; }
|
||||||
|
|
||||||
Dictionary<int, ITourModel> ExcursionGroupTours { get; }
|
Dictionary<int, ITourModel> ExcursionGroupTours { get; }
|
||||||
|
|
||||||
|
Dictionary<int, IPlaceModel> ExcursionGroupPlaces { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ namespace TravelAgencyDatabaseImplement.Implements
|
|||||||
.Include(x => x.Guide)
|
.Include(x => x.Guide)
|
||||||
.Include(x => x.Tours)
|
.Include(x => x.Tours)
|
||||||
.ThenInclude(x => x.Tour)
|
.ThenInclude(x => x.Tour)
|
||||||
|
.Include(x => x.Places)
|
||||||
|
.ThenInclude(x => x.Place)
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -32,6 +34,8 @@ namespace TravelAgencyDatabaseImplement.Implements
|
|||||||
.Include(x => x.Guide)
|
.Include(x => x.Guide)
|
||||||
.Include(x => x.Tours)
|
.Include(x => x.Tours)
|
||||||
.ThenInclude(x => x.Tour)
|
.ThenInclude(x => x.Tour)
|
||||||
|
.Include(x => x.Places)
|
||||||
|
.ThenInclude(x => x.Place)
|
||||||
.Where(x => x.ExcursionGroupName.Contains(model.ExcursionGroupName))
|
.Where(x => x.ExcursionGroupName.Contains(model.ExcursionGroupName))
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
@ -44,6 +48,8 @@ namespace TravelAgencyDatabaseImplement.Implements
|
|||||||
.Include(x => x.Guide)
|
.Include(x => x.Guide)
|
||||||
.Include(x => x.Tours)
|
.Include(x => x.Tours)
|
||||||
.ThenInclude(x => x.Tour)
|
.ThenInclude(x => x.Tour)
|
||||||
|
.Include(x => x.Places)
|
||||||
|
.ThenInclude(x => x.Place)
|
||||||
.Where(x => x.UserId.Equals(model.UserId))
|
.Where(x => x.UserId.Equals(model.UserId))
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
@ -56,6 +62,8 @@ namespace TravelAgencyDatabaseImplement.Implements
|
|||||||
.Include(x => x.Guide)
|
.Include(x => x.Guide)
|
||||||
.Include(x => x.Tours)
|
.Include(x => x.Tours)
|
||||||
.ThenInclude(x => x.Tour)
|
.ThenInclude(x => x.Tour)
|
||||||
|
.Include(x => x.Places)
|
||||||
|
.ThenInclude(x => x.Place)
|
||||||
.Where(x => x.GuideId.Equals(model.GuideId))
|
.Where(x => x.GuideId.Equals(model.GuideId))
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
@ -76,6 +84,8 @@ namespace TravelAgencyDatabaseImplement.Implements
|
|||||||
.Include(x => x.Guide)
|
.Include(x => x.Guide)
|
||||||
.Include(x => x.Tours)
|
.Include(x => x.Tours)
|
||||||
.ThenInclude(x => x.Tour)
|
.ThenInclude(x => x.Tour)
|
||||||
|
.Include(x => x.Places)
|
||||||
|
.ThenInclude(x => x.Place)
|
||||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ExcursionGroupName) && x.ExcursionGroupName == model.ExcursionGroupName) ||
|
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.ExcursionGroupName) && x.ExcursionGroupName == model.ExcursionGroupName) ||
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
@ -108,6 +118,7 @@ namespace TravelAgencyDatabaseImplement.Implements
|
|||||||
excursionGroup.Update(model);
|
excursionGroup.Update(model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
excursionGroup.UpdateTours(context, model);
|
excursionGroup.UpdateTours(context, model);
|
||||||
|
excursionGroup.UpdatePlaces(context, model);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
return excursionGroup.GetViewModel;
|
return excursionGroup.GetViewModel;
|
||||||
}
|
}
|
||||||
@ -123,6 +134,7 @@ namespace TravelAgencyDatabaseImplement.Implements
|
|||||||
using var context = new TravelAgencyDatabase();
|
using var context = new TravelAgencyDatabase();
|
||||||
var element = context.ExcursionGroups
|
var element = context.ExcursionGroups
|
||||||
.Include(x => x.Tours)
|
.Include(x => x.Tours)
|
||||||
|
.Include(x => x.Places)
|
||||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
if (element != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ using TravelAgencyDatabaseImplement;
|
|||||||
namespace TravelAgencyDatabaseImplement.Migrations
|
namespace TravelAgencyDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(TravelAgencyDatabase))]
|
[DbContext(typeof(TravelAgencyDatabase))]
|
||||||
[Migration("20240529001818_InitialCreate")]
|
[Migration("20240529060724_InitialCreate")]
|
||||||
partial class InitialCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -89,6 +89,29 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
b.ToTable("ExcursionGroups");
|
b.ToTable("ExcursionGroups");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupPlace", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ExcursionGroupId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("PlaceId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ExcursionGroupId");
|
||||||
|
|
||||||
|
b.HasIndex("PlaceId");
|
||||||
|
|
||||||
|
b.ToTable("ExcursionGroupPlaces");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -328,6 +351,25 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
b.Navigation("User");
|
b.Navigation("User");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupPlace", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TravelAgencyDatabaseImplement.Models.ExcursionGroup", "ExcursionGroup")
|
||||||
|
.WithMany("Places")
|
||||||
|
.HasForeignKey("ExcursionGroupId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("TravelAgencyDatabaseImplement.Models.Place", "Place")
|
||||||
|
.WithMany("ExcursionGroups")
|
||||||
|
.HasForeignKey("PlaceId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("ExcursionGroup");
|
||||||
|
|
||||||
|
b.Navigation("Place");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("TravelAgencyDatabaseImplement.Models.ExcursionGroup", "ExcursionGroup")
|
b.HasOne("TravelAgencyDatabaseImplement.Models.ExcursionGroup", "ExcursionGroup")
|
||||||
@ -414,6 +456,8 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroup", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroup", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("Places");
|
||||||
|
|
||||||
b.Navigation("Tours");
|
b.Navigation("Tours");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -426,6 +470,8 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Place", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Place", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("ExcursionGroups");
|
||||||
|
|
||||||
b.Navigation("Excursions");
|
b.Navigation("Excursions");
|
||||||
|
|
||||||
b.Navigation("Trips");
|
b.Navigation("Trips");
|
@ -183,6 +183,32 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ExcursionGroupPlaces",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ExcursionGroupId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
PlaceId = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ExcursionGroupPlaces", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ExcursionGroupPlaces_ExcursionGroups_ExcursionGroupId",
|
||||||
|
column: x => x.ExcursionGroupId,
|
||||||
|
principalTable: "ExcursionGroups",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ExcursionGroupPlaces_Places_PlaceId",
|
||||||
|
column: x => x.PlaceId,
|
||||||
|
principalTable: "Places",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "ExcursionGroupTours",
|
name: "ExcursionGroupTours",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -235,6 +261,16 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ExcursionGroupPlaces_ExcursionGroupId",
|
||||||
|
table: "ExcursionGroupPlaces",
|
||||||
|
column: "ExcursionGroupId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ExcursionGroupPlaces_PlaceId",
|
||||||
|
table: "ExcursionGroupPlaces",
|
||||||
|
column: "PlaceId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_ExcursionGroups_GuideId",
|
name: "IX_ExcursionGroups_GuideId",
|
||||||
table: "ExcursionGroups",
|
table: "ExcursionGroups",
|
||||||
@ -299,6 +335,9 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ExcursionGroupPlaces");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ExcursionGroupTours");
|
name: "ExcursionGroupTours");
|
||||||
|
|
@ -86,6 +86,29 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
b.ToTable("ExcursionGroups");
|
b.ToTable("ExcursionGroups");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupPlace", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ExcursionGroupId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("PlaceId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ExcursionGroupId");
|
||||||
|
|
||||||
|
b.HasIndex("PlaceId");
|
||||||
|
|
||||||
|
b.ToTable("ExcursionGroupPlaces");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -325,6 +348,25 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
b.Navigation("User");
|
b.Navigation("User");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupPlace", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("TravelAgencyDatabaseImplement.Models.ExcursionGroup", "ExcursionGroup")
|
||||||
|
.WithMany("Places")
|
||||||
|
.HasForeignKey("ExcursionGroupId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("TravelAgencyDatabaseImplement.Models.Place", "Place")
|
||||||
|
.WithMany("ExcursionGroups")
|
||||||
|
.HasForeignKey("PlaceId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("ExcursionGroup");
|
||||||
|
|
||||||
|
b.Navigation("Place");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroupTour", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("TravelAgencyDatabaseImplement.Models.ExcursionGroup", "ExcursionGroup")
|
b.HasOne("TravelAgencyDatabaseImplement.Models.ExcursionGroup", "ExcursionGroup")
|
||||||
@ -411,6 +453,8 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroup", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.ExcursionGroup", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("Places");
|
||||||
|
|
||||||
b.Navigation("Tours");
|
b.Navigation("Tours");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -423,6 +467,8 @@ namespace TravelAgencyDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Place", b =>
|
modelBuilder.Entity("TravelAgencyDatabaseImplement.Models.Place", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("ExcursionGroups");
|
||||||
|
|
||||||
b.Navigation("Excursions");
|
b.Navigation("Excursions");
|
||||||
|
|
||||||
b.Navigation("Trips");
|
b.Navigation("Trips");
|
||||||
|
@ -47,6 +47,25 @@ namespace TravelAgencyDatabaseImplement.Models
|
|||||||
[ForeignKey("ExcursionGroupId")]
|
[ForeignKey("ExcursionGroupId")]
|
||||||
public virtual List<ExcursionGroupTour> Tours { get; set; } = new();
|
public virtual List<ExcursionGroupTour> Tours { get; set; } = new();
|
||||||
|
|
||||||
|
private Dictionary<int, IPlaceModel>? _excursionGroupPlaces = null;
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public Dictionary<int, IPlaceModel> ExcursionGroupPlaces
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_excursionGroupPlaces == null)
|
||||||
|
{
|
||||||
|
_excursionGroupPlaces = Places
|
||||||
|
.ToDictionary(recPC => recPC.PlaceId, recPC => recPC.Place as IPlaceModel);
|
||||||
|
}
|
||||||
|
return _excursionGroupPlaces;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ForeignKey("ExcursionGroupId")]
|
||||||
|
public virtual List<ExcursionGroupPlace> Places { get; set; } = new();
|
||||||
|
|
||||||
public static ExcursionGroup? Create(TravelAgencyDatabase context, ExcursionGroupBindingModel? model)
|
public static ExcursionGroup? Create(TravelAgencyDatabase context, ExcursionGroupBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@ -65,6 +84,10 @@ namespace TravelAgencyDatabaseImplement.Models
|
|||||||
Tours = model.ExcursionGroupTours.Select(x => new ExcursionGroupTour
|
Tours = model.ExcursionGroupTours.Select(x => new ExcursionGroupTour
|
||||||
{
|
{
|
||||||
Tour = context.Tours.First(y => y.Id == x.Key)
|
Tour = context.Tours.First(y => y.Id == x.Key)
|
||||||
|
}).ToList(),
|
||||||
|
Places = model.ExcursionGroupPlaces.Select(x => new ExcursionGroupPlace
|
||||||
|
{
|
||||||
|
Place = context.Places.First(y => y.Id == x.Key)
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -90,7 +113,8 @@ namespace TravelAgencyDatabaseImplement.Models
|
|||||||
UserId = UserId,
|
UserId = UserId,
|
||||||
GuideId = GuideId,
|
GuideId = GuideId,
|
||||||
GuideFIO = Guide?.GuideFIO,
|
GuideFIO = Guide?.GuideFIO,
|
||||||
ExcursionGroupTours = ExcursionGroupTours
|
ExcursionGroupTours = ExcursionGroupTours,
|
||||||
|
ExcursionGroupPlaces = ExcursionGroupPlaces
|
||||||
};
|
};
|
||||||
|
|
||||||
public void UpdateTours(TravelAgencyDatabase context, ExcursionGroupBindingModel model)
|
public void UpdateTours(TravelAgencyDatabase context, ExcursionGroupBindingModel model)
|
||||||
@ -118,5 +142,31 @@ namespace TravelAgencyDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
_excursionGroupTours = null;
|
_excursionGroupTours = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdatePlaces(TravelAgencyDatabase context, ExcursionGroupBindingModel model)
|
||||||
|
{
|
||||||
|
var excursionGroupPlaces = context.ExcursionGroupPlaces.Where(rec => rec.ExcursionGroupId == model.Id).ToList();
|
||||||
|
if (excursionGroupPlaces != null && excursionGroupPlaces.Count > 0)
|
||||||
|
{ // удалили те, которых нет в модели
|
||||||
|
context.ExcursionGroupPlaces.RemoveRange(excursionGroupPlaces.Where(rec => !model.ExcursionGroupPlaces.ContainsKey(rec.PlaceId)));
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
var excursionGroup = context.ExcursionGroups.First(x => x.Id == Id);
|
||||||
|
foreach (var et in model.ExcursionGroupPlaces)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (excursionGroupPlaces!.Any(x => x.PlaceId == et.Key))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
context.ExcursionGroupPlaces.Add(new ExcursionGroupPlace
|
||||||
|
{
|
||||||
|
ExcursionGroup = excursionGroup,
|
||||||
|
Place = context.Places.First(x => x.Id == et.Key)
|
||||||
|
});
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
_excursionGroupPlaces = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace TravelAgencyDatabaseImplement.Models
|
||||||
|
{
|
||||||
|
public class ExcursionGroupPlace
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int ExcursionGroupId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public int PlaceId { get; set; }
|
||||||
|
|
||||||
|
public virtual ExcursionGroup ExcursionGroup { get; set; } = new();
|
||||||
|
|
||||||
|
public virtual Place Place { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,9 @@ namespace TravelAgencyDatabaseImplement.Models
|
|||||||
[ForeignKey("PlaceId")]
|
[ForeignKey("PlaceId")]
|
||||||
public virtual List<Excursion> Excursions { get; set; } = new();
|
public virtual List<Excursion> Excursions { get; set; } = new();
|
||||||
|
|
||||||
|
[ForeignKey("PlaceId")]
|
||||||
|
public virtual List<ExcursionGroupPlace> ExcursionGroups { get; set; } = new();
|
||||||
|
|
||||||
public static Place? Create(PlaceBindingModel? model)
|
public static Place? Create(PlaceBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
|
@ -24,6 +24,8 @@ namespace TravelAgencyDatabaseImplement
|
|||||||
|
|
||||||
public virtual DbSet<ExcursionGroupTour> ExcursionGroupTours { set; get; }
|
public virtual DbSet<ExcursionGroupTour> ExcursionGroupTours { set; get; }
|
||||||
|
|
||||||
|
public virtual DbSet<ExcursionGroupPlace> ExcursionGroupPlaces { set; get; }
|
||||||
|
|
||||||
public virtual DbSet<Guide> Guides { set; get; }
|
public virtual DbSet<Guide> Guides { set; get; }
|
||||||
|
|
||||||
public virtual DbSet<Place> Places { set; get; }
|
public virtual DbSet<Place> Places { set; get; }
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using TravelAgencyContracts.BindingModels;
|
using TravelAgencyContracts.BindingModels;
|
||||||
using TravelAgencyContracts.BusinessLogicsContracts;
|
using TravelAgencyContracts.BusinessLogicsContracts;
|
||||||
using TravelAgencyContracts.SearchModels;
|
using TravelAgencyContracts.SearchModels;
|
||||||
@ -18,12 +20,15 @@ namespace TravelAgencyWebApp.Controllers
|
|||||||
|
|
||||||
private readonly IGuideLogic _guideLogic;
|
private readonly IGuideLogic _guideLogic;
|
||||||
|
|
||||||
public ExcursionGroupController(ILogger<ExcursionGroupController> logger, IExcursionGroupLogic excursionGroupLogic, ITourLogic tourLogic, IGuideLogic guideLogic)
|
private readonly IPlaceLogic _placeLogic;
|
||||||
|
|
||||||
|
public ExcursionGroupController(ILogger<ExcursionGroupController> logger, IExcursionGroupLogic excursionGroupLogic, ITourLogic tourLogic, IGuideLogic guideLogic, IPlaceLogic placeLogic)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_excursionGroupLogic = excursionGroupLogic;
|
_excursionGroupLogic = excursionGroupLogic;
|
||||||
_tourLogic = tourLogic;
|
_tourLogic = tourLogic;
|
||||||
_guideLogic = guideLogic;
|
_guideLogic = guideLogic;
|
||||||
|
_placeLogic = placeLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -129,6 +134,8 @@ namespace TravelAgencyWebApp.Controllers
|
|||||||
excursionGroupTours.Add(tourId, _tourLogic.ReadElement(new TourSearchModel { Id = tourId })!);
|
excursionGroupTours.Add(tourId, _tourLogic.ReadElement(new TourSearchModel { Id = tourId })!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var excursionGroup = _excursionGroupLogic.ReadElement(new ExcursionGroupSearchModel() { Id = id });
|
||||||
|
|
||||||
_excursionGroupLogic.Update(new ExcursionGroupBindingModel
|
_excursionGroupLogic.Update(new ExcursionGroupBindingModel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
@ -136,7 +143,8 @@ namespace TravelAgencyWebApp.Controllers
|
|||||||
ParticipantsAmount = participantsAmount,
|
ParticipantsAmount = participantsAmount,
|
||||||
UserId = LoggedinUser.User.Id,
|
UserId = LoggedinUser.User.Id,
|
||||||
GuideId = guide,
|
GuideId = guide,
|
||||||
ExcursionGroupTours = excursionGroupTours
|
ExcursionGroupTours = excursionGroupTours,
|
||||||
|
ExcursionGroupPlaces = excursionGroup.ExcursionGroupPlaces
|
||||||
});
|
});
|
||||||
|
|
||||||
Response.Redirect("/ExcursionGroup/ExcursionGroups");
|
Response.Redirect("/ExcursionGroup/ExcursionGroups");
|
||||||
@ -157,5 +165,61 @@ namespace TravelAgencyWebApp.Controllers
|
|||||||
|
|
||||||
Response.Redirect("/ExcursionGroup/ExcursionGroups");
|
Response.Redirect("/ExcursionGroup/ExcursionGroups");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult ConnectGroupToPlace()
|
||||||
|
{
|
||||||
|
if (LoggedinUser.User == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewBag.ExcursionGroups = _excursionGroupLogic.ReadList(new ExcursionGroupSearchModel
|
||||||
|
{
|
||||||
|
UserId = LoggedinUser.User.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
ViewBag.Places = _placeLogic.ReadList(null);
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult ConnectGroupToPlace(int excursionGroupId, int placeId)
|
||||||
|
{
|
||||||
|
if (LoggedinUser.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Необходимо авторизоваться!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (excursionGroupId <= 0 || placeId <= 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Введены не все данные!");
|
||||||
|
}
|
||||||
|
var excursionGroup = _excursionGroupLogic.ReadElement(new ExcursionGroupSearchModel() { Id = excursionGroupId });
|
||||||
|
Dictionary<int, IPlaceModel> excursionGroupPlaces = excursionGroup.ExcursionGroupPlaces;
|
||||||
|
if (!excursionGroupPlaces.ContainsKey(placeId))
|
||||||
|
excursionGroupPlaces.Add(placeId, _placeLogic.ReadElement(new PlaceSearchModel { Id = placeId })!);
|
||||||
|
|
||||||
|
_excursionGroupLogic.Update(new ExcursionGroupBindingModel
|
||||||
|
{
|
||||||
|
Id = excursionGroupId,
|
||||||
|
ExcursionGroupName = excursionGroup.ExcursionGroupName,
|
||||||
|
ParticipantsAmount = excursionGroup.ParticipantsAmount,
|
||||||
|
UserId = LoggedinUser.User.Id,
|
||||||
|
GuideId = excursionGroup.GuideId,
|
||||||
|
ExcursionGroupTours = excursionGroup.ExcursionGroupTours,
|
||||||
|
ExcursionGroupPlaces = excursionGroupPlaces
|
||||||
|
});
|
||||||
|
|
||||||
|
ViewBag.ExcursionGroups = _excursionGroupLogic.ReadList(new ExcursionGroupSearchModel
|
||||||
|
{
|
||||||
|
UserId = LoggedinUser.User.Id,
|
||||||
|
});
|
||||||
|
|
||||||
|
ViewBag.Places = _placeLogic.ReadList(null);
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,48 @@ namespace TravelAgencyWebApp.Controllers
|
|||||||
return View(LoggedinUser.User);
|
return View(LoggedinUser.User);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
if (LoggedinUser.User == null)
|
||||||
}
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
return View(LoggedinUser.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void Privacy(string userFIO, string email, string phoneNumber, string password)
|
||||||
|
{
|
||||||
|
if (LoggedinUser.User == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Необходимо авторизоваться!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(userFIO) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(phoneNumber) || string.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
throw new Exception("Введены не все данные!");
|
||||||
|
}
|
||||||
|
|
||||||
|
_userLogic.Update(new UserBindingModel
|
||||||
|
{
|
||||||
|
Id = LoggedinUser.User.Id,
|
||||||
|
UserFIO = userFIO,
|
||||||
|
Email = email,
|
||||||
|
PhoneNumber = phoneNumber,
|
||||||
|
Password = password
|
||||||
|
});
|
||||||
|
|
||||||
|
LoggedinUser.User.UserFIO = userFIO;
|
||||||
|
LoggedinUser.User.Email = email;
|
||||||
|
LoggedinUser.User.PhoneNumber = phoneNumber;
|
||||||
|
LoggedinUser.User.Password = password;
|
||||||
|
|
||||||
|
Response.Redirect("Privacy");
|
||||||
|
}
|
||||||
|
|
||||||
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||||
@ -139,6 +174,10 @@ namespace TravelAgencyWebApp.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult ReportMenu()
|
public IActionResult ReportMenu()
|
||||||
{
|
{
|
||||||
|
if (LoggedinUser.User == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Место для посещения:</div>
|
<div class="col-4">Место для посещения:</div>
|
||||||
<div class="col-8">
|
<div class="col-2">
|
||||||
<select id="place" name="place" class="form-control" asp-items="@(new SelectList(@ViewBag.Places,"Id", "PlaceName"))"></select>
|
<select id="place" name="place" class="form-control" asp-items="@(new SelectList(@ViewBag.Places,"Id", "PlaceName"))"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div>Туры</div>
|
<div class="fw-bold fs-4">Туры</div>
|
||||||
<div class="table-responsive-lg">
|
<div class="table-responsive-lg">
|
||||||
<table id="tourstable" class="display">
|
<table id="tourstable" class="display col-4">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Название</th>
|
<th>Название</th>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Место для посещения:</div>
|
<div class="col-4">Место для посещения:</div>
|
||||||
<div class="col-8">
|
<div class="col-2">
|
||||||
<select id="place" name="place" class="form-control">
|
<select id="place" name="place" class="form-control">
|
||||||
@foreach (var place in ViewBag.Places)
|
@foreach (var place in ViewBag.Places)
|
||||||
{
|
{
|
||||||
@ -33,9 +33,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div>Туры</div>
|
<div class="fw-bold fs-4">Туры</div>
|
||||||
<div class="table-responsive-lg">
|
<div class="table-responsive-lg">
|
||||||
<table id="tourstable" class="display">
|
<table id="tourstable" class="display col-4">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Название</th>
|
<th>Название</th>
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Create group to place";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-5">Связывание группы и места для посещения</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post" class="my-5">
|
||||||
|
<div class="row my-3 d-flex justify-content-center">
|
||||||
|
<div class="col-2">Группа:</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<select id="excursionGroupId" name="excursionGroupId" class="form-control" asp-items="@(new SelectList(@ViewBag.ExcursionGroups,"Id", "ExcursionGroupName"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row my-3 d-flex justify-content-center">
|
||||||
|
<div class="col-2">Место:</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<select id="placeId" name="placeId" class="form-control" asp-items="@(new SelectList(@ViewBag.Places,"Id", "PlaceName"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="my-3 d-flex justify-content-center"><input type="submit" value="Связать" class="btn btn-primary" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Группа
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Место
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var eg in ViewBag.ExcursionGroups)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@eg.ExcursionGroupName
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
foreach (var ep in eg.ExcursionGroupPlaces) {
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@ep.Value.PlaceName
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
@ -15,14 +15,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Гид:</div>
|
<div class="col-4">Гид:</div>
|
||||||
<div class="col-8">
|
<div class="col-2">
|
||||||
<select id="guide" name="guide" class="form-control" asp-items="@(new SelectList(@ViewBag.Guides,"Id", "GuideFIO"))"></select>
|
<select id="guide" name="guide" class="form-control" asp-items="@(new SelectList(@ViewBag.Guides,"Id", "GuideFIO"))"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div>Туры</div>
|
<div class="fw-bold fs-4">Туры</div>
|
||||||
<div class="table-responsive-lg">
|
<div class="table-responsive-lg">
|
||||||
<table id="tourstable" class="display">
|
<table id="tourstable" class="display col-4">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Название</th>
|
<th>Название</th>
|
||||||
|
@ -32,10 +32,7 @@
|
|||||||
Название
|
Название
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Описание
|
Кол-во участников
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Цена
|
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Гид
|
Гид
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Гид:</div>
|
<div class="col-4">Гид:</div>
|
||||||
<div class="col-8">
|
<div class="col-2">
|
||||||
<select id="guide" name="guide" class="form-control">
|
<select id="guide" name="guide" class="form-control">
|
||||||
@foreach (var guide in ViewBag.Guides)
|
@foreach (var guide in ViewBag.Guides)
|
||||||
{
|
{
|
||||||
@ -29,9 +29,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div>Туры</div>
|
<div class="fw-bold fs-4">Туры</div>
|
||||||
<div class="table-responsive-lg">
|
<div class="table-responsive-lg">
|
||||||
<table id="tourstable" class="display">
|
<table id="tourstable" class="display col-4">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Название</th>
|
<th>Название</th>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<form method="post">
|
<form method="post">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Логин(почта):</div>
|
<div class="col-4">Логин(почта):</div>
|
||||||
<div class="col-8"><input type="text" name="login" value="@Model.Email" /></div>
|
<div class="col-8"><input type="text" name="email" value="@Model.Email" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Пароль:</div>
|
<div class="col-4">Пароль:</div>
|
||||||
@ -19,11 +19,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Номер телефона:</div>
|
<div class="col-4">Номер телефона:</div>
|
||||||
<div class="col-8"><input type="text" name="phone" value="@Model.PhoneNumber" /></div>
|
<div class="col-8"><input type="text" name="phoneNumber" value="@Model.PhoneNumber" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">ФИО:</div>
|
<div class="col-4">ФИО:</div>
|
||||||
<div class="col-8"><input type="text" name="fio" value="@Model.UserFIO" /></div>
|
<div class="col-8"><input type="text" name="userFIO" value="@Model.UserFIO" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8"></div>
|
<div class="col-8"></div>
|
||||||
|
@ -51,12 +51,14 @@
|
|||||||
{
|
{
|
||||||
foreach (var record in Model)
|
foreach (var record in Model)
|
||||||
{
|
{
|
||||||
<td>@record.Tour.TourName</td>
|
<tr>
|
||||||
<td>@record.Tour.Price</td>
|
<td>@record.Tour.TourName</td>
|
||||||
<td>@record.Tour.TourDate</td>
|
<td>@record.Tour.Price</td>
|
||||||
<td></td>
|
<td>@record.Tour.TourDate.ToShortDateString()</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
var excursionGroups = new List<ExcursionGroupViewModel>(record.ExcursionGroups);
|
var excursionGroups = new List<ExcursionGroupViewModel>(record.ExcursionGroups);
|
||||||
var guides = new List<GuideViewModel>(record.Guides);
|
var guides = new List<GuideViewModel>(record.Guides);
|
||||||
for (int i = 0; i < excursionGroups.Count; i++)
|
for (int i = 0; i < excursionGroups.Count; i++)
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div>Выберите тур:</div>
|
<p fw-bold fs-4>Выберите тур:</p>
|
||||||
<div class="table-responsive-lg">
|
<div class="table-responsive-lg">
|
||||||
<table id="tourstable" class="display">
|
<table id="tourstable" class="display col-4">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Название</th>
|
<th>Название</th>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Турфирма «Иван Сусанин»</a>
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Турфирма «Иван Сусанин»</a>
|
||||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||||
aria-expanded="false" aria-label="Toggle navigation">
|
aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
@ -42,6 +42,9 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="ExcursionGroup" asp-action="ExcursionGroups">Экскурсионные группы</a>
|
<a class="nav-link text-dark" asparea="" asp-controller="ExcursionGroup" asp-action="ExcursionGroups">Экскурсионные группы</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-dark" asparea="" asp-controller="ExcursionGroup" asp-action="ConnectGroupToPlace">Связать группу с местом</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ReportMenu">Отчеты</a>
|
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ReportMenu">Отчеты</a>
|
||||||
</li>
|
</li>
|
||||||
@ -57,7 +60,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<footer class="border-top footer text-muted">
|
<footer class="border-top footer text-muted">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
© 2024 - Иван Сусанин - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
© 2024 - Иван Сусанин - <a asparea="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
@ -15,65 +15,65 @@
|
|||||||
@{
|
@{
|
||||||
if (Model == null)
|
if (Model == null)
|
||||||
{
|
{
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
<h3 class="display-4">Авторизируйтесь</h3>
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="CreateTour">Создать тур</a>
|
<a asp-action="CreateTour">Создать тур</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
Номер
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Название
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Описание
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Цена
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Дата тура
|
|
||||||
</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var tour in Model)
|
|
||||||
{
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => tour.Id)
|
Номер
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => tour.TourName)
|
Название
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => tour.TourDescription)
|
Описание
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => tour.Price)
|
Цена
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<th>
|
||||||
@Html.DisplayFor(modelItem => tour.TourDate)
|
Дата тура
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<th></th>
|
||||||
<button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdateTour", "/Tour", new { id = tour.Id })'">Изменить</button>
|
<th></th>
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-primary" onclick="$.post('@Url.Action("DeleteTour", "/Tour", new { id = tour.Id })', function () {window.location.reload();})">
|
|
||||||
Удалить
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var tour in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@tour.Id
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@tour.TourName
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@tour.TourDescription
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@tour.Price
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@tour.TourDate.ToShortDateString()
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-primary" onclick="location.href='@Url.Action("UpdateTour", "/Tour", new { id = tour.Id })'">Изменить</button>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-primary" onclick="$.post('@Url.Action("DeleteTour", "/Tour", new { id = tour.Id })', function () {window.location.reload();})">
|
||||||
|
Удалить
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user