Hi !
Say at once: I'm only beginner in web-programming, so sorry if my question is too easy to answer or maybe is too hard to understand.
So, now question: I'm doing my first Afisha web-site. I have some Events (Event Entity) and an action to show information about the specific event.
On this page i have a button "Add to cart", by clicking on which, opens modal-window. In this window user can choose session, hall (which is selected automatically by session), and select one or more seats in the hall.
After choosing all required user can push button "Confirm" and that button should create in Ticket Controller Entities in Database.
And now the exact problem. If choose only 1 seat - it's easy. Just create 1 row in DB and that's all. But what if seats not only one - two or more? I tried to change my Ticket Entity and now i have this:
using System.ComponentModel.DataAnnotations;
namespace Afisha.Domain.Entities
{
public class Ticket
{
[Required]
public string UserName { get; set; }
//[Required]
//public int Number { get; set; }
public Ticket()
{
}
public Ticket(Event _event, int number, string username, byte[] QR)
{
//DateAdded = DateTime.UtcNow;
UserName = username;
//Number = number;
Address = _event.Address;
Age = _event.Age;
Title = _event.Title;
Subtitle = _event.Subtitle;
Text = _event.Text;
TitleImagePath = _event.TitleImagePath;
//MetaTitle = _event.MetaTitle;
//MetaDescription = _event.MetaDescription;
//MetaKeywords = _event.MetaKeywords;
Date = _event.Date;
//PCard = _event.PCard;
Type = _event.Type;
Cost = _event.Cost;
Image = _event.Image;
this.QR = QR;
}
[Required]
public Guid Id { get; set; }
[Required(ErrorMessage = "Заполните название мероприятия")]
[Display(Name = "Название (заголовок)")]
public string? Title { get; set; }
[Display(Name = "Адрес")]
public string? Address { get; set; }
[Display(Name = "Краткое описание")]
public string? Subtitle { get; set; }
[Display(Name = "Полное описание")]
public string? Text { get; set; }
[Display(Name = "Титульная картинка")]
public string? TitleImagePath { get; set; }
public byte[]? Image { get; set; }
public byte[]? QR { get; set; }
[DataType(DataType.Time)]
public DateTime Date { get; set; }
[Display(Name = "Стоимость билета")]
public string? Cost { get; set; }
[Display(Name = "Тип мероприятия")]
public string? Type { get; set; }
[Display(Name = "Возрастное ограничение")]
public int? Age { get; set; }
}
}
But i think that save seats as massive - is not good idea.
Can someone, who will understand my question help me?
I would be very grateful !