Ejemplo n.º 1
0
 public void ChangeLogo()
 {
     try
     {
         Microsoft.Win32.OpenFileDialog op = new Microsoft.Win32.OpenFileDialog
         {
             Title  = "Vyberte obrázek",
             Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                      "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                      "Portable Network Graphic (*.png)|*.png"
         };
         if (op.ShowDialog() == true)
         {
             string path;
             var    fileName = Helpers.RandomStringGenerator.RandomString(10);
             System.IO.Directory.CreateDirectory(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Graphics"));
             path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Graphics", fileName);
             System.IO.File.Copy(op.FileName, path, true);
             ShelterModel.SetLogo(path);
             MessageBox.Show("Logo bylo změněno úspěšně.");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
0
        public ViewResult PetDetails(int petId)
        {
            ShelterModel shelter = new ShelterModel();

            shelter.Pet = repository.Pets.FirstOrDefault(p => p.Id == petId);
            var user = userManager.Users.FirstOrDefault(s => s.Id == shelter.Pet.UserId);

            shelter.User = user;
            return(View("~/Views/Pet/PetDetails.cshtml", shelter));
        }
Ejemplo n.º 3
0
        public IActionResult Put(int id, [FromBody] ShelterModel updatedShelter)
        {
            var shelter = _shelterService.Update(updatedShelter.ToDomainModel());

            if (shelter == null)
            {
                return(NotFound());
            }
            return(Ok(shelter));
        }
Ejemplo n.º 4
0
 public void SetShelterInfo()
 {
     ShelterModel          = new ShelterModel();
     ShelterName           = ShelterModel.Name;
     ShelterPhone          = ShelterModel.Phone;
     ShelterEmergencyPhone = ShelterModel.Phone2;
     ShelterMail           = ShelterModel.Mail;
     ShelterAdress         = ShelterModel.Adress;
     ShelterAccount        = ShelterModel.Account;
     ShelterLogo           = ShelterModel.LogoPath;
 }
Ejemplo n.º 5
0
        public IActionResult Post([FromBody] ShelterModel newShelter)
        {
            try
            {
                _shelterService.Add(newShelter.ToDomainModel());
            }
            catch (System.Exception ex)
            {
                ModelState.AddModelError("AddShelter", ex.GetBaseException().Message);
                return(BadRequest(ModelState));
            }

            return(CreatedAtAction("Get", new { Id = newShelter.Id }, newShelter));
        }
Ejemplo n.º 6
0
 public CardPageViewModel()
 {
     ShelterModel = new ShelterModel();
 }
Ejemplo n.º 7
0
 public SettingsViewModel()
 {
     ComboBoxSettings();
     ShelterInfo = new ShelterModel();
 }