public static bool TestConnection(string hostname, string port)
 {
     try
     {
         MUtility.ShowInformation(Api.TestConnection(hostname, port));
         return(true);
     }
     catch (Exception ex)
     {
         MUtility.ShowInformation(ex.Message);
         return(false);
     }
 }
        internal static bool AddNewUser(User u)
        {
            try
            {
                KorisnikKreiranjeDto k = new KorisnikKreiranjeDto()
                {
                    IdKorisnika   = u.UserID,
                    Ime           = u.FirstName,
                    Prezime       = u.LastName,
                    DatumRodjenja = u.Birthday,
                    KorisnickoIme = u.Username,
                    Email         = u.Email,
                    Sifra         = u.Password,
                    IdFakulteta   = (u.Faculty != null) ? u.Faculty.FacultyID : 0,
                    BrojIndeksa   = u.Index,
                    BrojTelefona  = u.PhoneNumber,
                    DatumVaziDo   = u.ValidUntil,
                    IdTipaNaloga  = (int)u.AccountType,
                    AktivanNalog  = u.ActiveAccount
                };
                KorisnikKreiranjeDto result = Api.AddNewUser(k);
                if (result != null)
                {
                    if (u.AccountType == User.UserAccountType.Student)
                    {
                        (new NewUserCreatedForm(result.IdKorisnika.ToString(), result.Sifra)).ShowDialog();
                    }
                    else
                    {
                        MUtility.ShowInformation(u.AccountType.ToString() + " nalog je uspesno kreiran");
                    }
                    u.UserID = result.IdKorisnika;
                    MainController.ChangeUserImage(u);
                }

                return(true);
            }
            catch (Exception e)
            {
                MUtility.ShowException(e);
                return(false);
            }
        }