private void saveChangesBtn_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { LocalEventsSeminarski_API.Models.EventGallery editedGallery = new EventGallery(); editedGallery.EventGalleryID = galleryID; editedGallery.Naziv = nazivInput.Text; editedGallery.Opis = opisInput.Text; editedGallery.DatumKreiranja = trazeniEvent.DatumKreiranja; editedGallery.EventID = trazeniEvent.EventID; int id = galleryID; HttpResponseMessage putResponse = eventGalleryService.PutResponse(id, editedGallery); if (putResponse.IsSuccessStatusCode) { MessageBox.Show("Saved Changes!"); } else { MessageBox.Show(putResponse.StatusCode.ToString()); } } }
public IHttpActionResult PutEventGallery(int id, EventGallery editedGallery) { db.esp_EventGallery_Update(editedGallery.EventGalleryID, editedGallery.Naziv, editedGallery.Opis); return(Ok()); }
public bool UpdateventGallery(EventGalleryModel events) { var objnewsevents = new EventGallery { EventName = events.EventName, ThumbnailImage = events.ThumbnailImage }; return(_objRepository.UpdateEventGallery(objnewsevents)); }
public IHttpActionResult PostEventGallery(EventGallery eventGallery) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } eventGallery.EventGalleryID = Convert.ToInt32(db.esp_EventGallery_Insert(eventGallery.EventID, eventGallery.Naziv, eventGallery.Opis, eventGallery.DatumKreiranja).FirstOrDefault()); return(CreatedAtRoute("DefaultApi", new { id = eventGallery.EventGalleryID }, eventGallery)); }
//Event Specific Gallery Section #region Event Specific Gallery Section public bool AddEventGallery(EventGallery eventinfo) { try { _entity.EventGalleries.Add(eventinfo); _entity.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public ActionResult Index(int?page) { files = imageslist(); eventList = EventList(); newsList = NewsList(); int pageSize = 8; int pageNumber = (page ?? 1); EventGallery objeventGallery = new EventGallery(); objeventGallery.eventList = eventList; objeventGallery.files = files; objeventGallery.NewsList = newsList.OrderByDescending(i => i.Date).ToPagedList(pageNumber, pageSize); return(View("Index", objeventGallery)); }
public IHttpActionResult DeleteEventGallery(int id) { EventGallery eventGallery = db.EventGalleries.Find(id); if (eventGallery == null) { return(NotFound()); } db.EventGalleries.Remove(eventGallery); db.SaveChanges(); return(Ok(eventGallery)); }
public bool DeleteeventGallery(long id) { try { EventGallery eventGallery = _entity.EventGalleries.First(m => m.Id == id); var geteventgalleryImages = _entity.EventImages.Where(a => a.EventGalleryId == id).ToList(); if (geteventgalleryImages != null && geteventgalleryImages.Any()) { _entity.EventImages.RemoveRange(geteventgalleryImages); } _entity.EventGalleries.Remove(eventGallery); _entity.SaveChanges(); return(true); } catch (Exception ex) { // Logging.TrackError(ex, "CreateLab"); return(false); } }
private void submitBtn_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { EventGallery eventGallery = new EventGallery(); eventGallery.EventID = galleryEventID; eventGallery.DatumKreiranja = DateTime.Now; eventGallery.Naziv = nazivInput.Text; eventGallery.Opis = opisRichTextBox.Text; HttpResponseMessage galleryResponse = eventGalleryService.PostResponse(eventGallery); if (galleryResponse.IsSuccessStatusCode) { MessageBox.Show("New Gallery Added!"); this.Close(); } else { MessageBox.Show("error"); } } }
protected override void OnAppearing() { System.Net.Http.HttpResponseMessage response1 = slikaService.GetActionResponse("GetByGalleryID", galleryID.ToString()); System.Net.Http.HttpResponseMessage response2 = eventGalleryService.GetActionResponse("GetByID", galleryID.ToString()); if (response1.IsSuccessStatusCode) { var jsonObject = response1.Content.ReadAsStringAsync(); List <Slika> slike = JsonConvert.DeserializeObject <List <Slika> >(jsonObject.Result); slikeListView.ItemsSource = slike; } else { DisplayAlert("error", "error", "ok"); } if (response2.IsSuccessStatusCode) { var jsonObject2 = response2.Content.ReadAsStringAsync(); EventGallery galerija = JsonConvert.DeserializeObject <EventGallery>(jsonObject2.Result); naziv.Text = galerija.Naziv; opis.Text = galerija.Opis; datum.Text = galerija.DatumKreiranja.ToString(); nazivLabel.Text = "Name: "; opis.Text = "Description: "; datumLabel.Text = "Created Date: "; } else { DisplayAlert("error", "error", "ok"); } base.OnAppearing(); }
public bool UpdateEventGallery(EventGallery eventinfo) { try { var objnewsevent = _entity.EventGalleries.Single(d => d.Id == eventinfo.Id); objnewsevent.EventName = eventinfo.EventName; objnewsevent.ThumbnailImage = eventinfo.ThumbnailImage; objnewsevent.Id = eventinfo.Id; if (eventinfo.EventImages.Any()) { objnewsevent.EventImages = eventinfo.EventImages; } else { var images = _entity.EventImages.Where(a => a.EventGalleryId == eventinfo.Id); foreach (var result in images) { if (result.EventGalleryId == null) { result.EventGalleryId = eventinfo.Id; } } objnewsevent.EventImages = images.ToList(); } _entity.SaveChanges(); return(true); } catch (Exception) { return(false); } }
private void eventGalleryList_ItemTapped(object sender, ItemTappedEventArgs e) { EventGallery galerija = e.Item as EventGallery; this.Navigation.PushAsync(new Events.GalleryDetailsPage(galerija.EventGalleryID)); }