public async Task<ActionResult> CheckoutVisitor(Visitor visitor)
        {
            try
            {
                var tmp = await db.Visitors.FirstOrDefaultAsync(x => x.Id == visitor.Id);
                if (tmp != null)
                {
                    tmp.DepartedAt = visitor.DepartedAt;
                    await db.SaveChangesAsync();
                }
            }
            catch (Exception)
            {
                return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);
            }

            return new HttpStatusCodeResult(HttpStatusCode.OK);
        }
 public async Task<ActionResult> AddVisitor(Visitor visitor)
 {
     try
     {
         if (ModelState.IsValid)
         {
             visitor.DepartedAt = SqlDateTime.MinValue.Value;
             visitor.Terminal = await db.Terminals.FindAsync(visitor.Terminal.Id);
             db.Visitors.Add(visitor);
             await db.SaveChangesAsync();
         }
     }
     catch (Exception)
     {
         return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);
     }
     
     return new HttpStatusCodeResult(HttpStatusCode.OK);
 }