public async Task <IActionResult> Create(AccountsCreateViewModel model)
        {
            try
            {
                Account result = new Account
                {
                    FirstName   = model.FirstName,
                    LastName    = model.LastName,
                    PhoneNumber = model.PhoneNumber,
                    Email       = model.Email,
                    Username    = model.Username,
                    Password    = model.Password,
                    Active      = true,
                    Role        = Roles.Receptionist,
                    Released    = null,
                    PersonalId  = model.PersonalId,
                    Start       = DateTime.Now
                };
                context.Accounts.Add(result);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(ClientsCreateViewModel model)
        {
            try
            {
                Client result = new Client
                {
                    FirstName   = model.FirstName,
                    LastName    = model.LastName,
                    PhoneNumber = model.PhoneNumber,
                    Email       = model.Email,
                    Adult       = model.Adult
                };
                context.Clients.Add(result);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(ReservationsCreateViewModel model)
        {
            try
            {
                Reservation result = new Reservation
                {
                    Room         = context.Rooms.Find(int.Parse(model.Room)),
                    Account      = context.Accounts.Find(int.Parse(model.Account)),
                    Start        = model.Start,
                    End          = model.End,
                    Breakfast    = model.Breakfast,
                    AllInclusive = model.AllInclusive,
                    Cost         = model.Cost
                };
                result.Room.Available = false;
                List <ClientReservations> clients = new List <ClientReservations>();
                foreach (string id in model.Clients)
                {
                    ClientReservations client = new ClientReservations
                    {
                        Client      = context.Clients.Find(int.Parse(id)),
                        Reservation = result
                    };
                    clients.Add(client);
                    context.Clients.Find(int.Parse(id)).previousReservations.Add(client);
                }
                result.Clients = clients;
                context.ClientReservations.AddRange(clients);
                context.Reservations.Add(result);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(RoomsCreateViewModel model)
        {
            try
            {
                Room result = new Room
                {
                    Id        = model.Id,
                    Capacity  = model.Capacity,
                    AdultBed  = model.AdultBed,
                    ChildBed  = model.ChildBed,
                    Available = model.Available,
                    Number    = model.Number,
                    RoomType  = model.RoomType
                };
                context.Rooms.Add(result);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }