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); } }
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)); }
public IActionResult Put(int id, [FromBody] ShelterModel updatedShelter) { var shelter = _shelterService.Update(updatedShelter.ToDomainModel()); if (shelter == null) { return(NotFound()); } return(Ok(shelter)); }
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; }
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)); }
public CardPageViewModel() { ShelterModel = new ShelterModel(); }
public SettingsViewModel() { ComboBoxSettings(); ShelterInfo = new ShelterModel(); }