public ActionResult Create(HttpPostedFileBase file) { try { var postareId = this.Request.Form["Poza.PostareId"]; int postareIdInt = int.Parse(postareId); if (file.ContentLength > 0) { string filename = Path.GetFileName(file.FileName); string path = Path.Combine(Server.MapPath(Imagine.CaleImagini), filename); file.SaveAs(path); Poza poza = new Poza(); poza.CalePoza = $"{Imagine.CaleImagini}/{filename}"; poza.PostareId = postareIdInt; BlogEntities db = new BlogEntities(); db.Pozas.Add(poza); db.SaveChanges(); } return(RedirectToAction("Edit", "Postare", new { id = postareIdInt })); } catch { ViewBag.Message = "Incarcare esuata!!"; return(View()); } }
public List <PozaCuComentarii> GetPoze() { var poze = new List <PozaCuComentarii>(); var query = (from file in _ctx.CreateQuery <FileEntity>(_filesTable.Name) select file).AsTableServiceQuery <FileEntity>(_ctx); foreach (var file in query) { var listaComentarii = GetComentariiPePoza(file.RowKey); var a = new Poza() { Description = file.RowKey, ThumbnailUrl = file.ThumbnailUrl, Url = file.Url }; var b = new PozaCuComentarii { Poza = a, Comentarii = listaComentarii }; poze.Add(b); } return(poze); }
public ActionResult GetLink(Poza poza) { var service = new AlbumFotoService(); ViewBag.Link = AlbumFotoService.GetBlobSasUri(service.PhotoContainer, poza.Description); return(View("Index", service.GetPoze())); }
public ActionResult DeleteConfirmed(int id) { Poza poza = db.Pozas.Find(id); db.Pozas.Remove(poza); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,PostareId,CalePoza")] Poza poza) { if (ModelState.IsValid) { db.Entry(poza).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PostareId = new SelectList(db.Postares, "Id", "Titlu", poza.PostareId); return(View(poza)); }
public ActionResult Create([Bind(Include = "Id,PostareId,CalePoza")] Poza poza) { if (ModelState.IsValid) { db.Pozas.Add(poza); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PostareId = new SelectList(db.Postares, "Id", "Titlu", poza.PostareId); return(View(poza)); }
// GET: Poza/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Poza poza = db.Pozas.Find(id); if (poza == null) { return(HttpNotFound()); } return(View(poza)); }
public void Save(Manager.Model.Poza poza1) { Poza poza = new Poza(); if (poza1 != null) { poza.Id = Guid.NewGuid(); poza.IdProdus = Guid.Parse(poza1.IdProdus); poza.CalePoza = poza1.CalePoza; poza.IsProduct = poza1.IsProduct; databaseContext.Poza.Add(poza); databaseContext.SaveChanges(); } }
// GET: Poza/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Poza poza = db.Pozas.Find(id); if (poza == null) { return(HttpNotFound()); } ViewBag.PostareId = new SelectList(db.Postares, "Id", "Titlu", poza.PostareId); return(View(poza)); }
public Poza GetPoza(Poza poza) { Poza poze; var query = (from file in _ctx.CreateQuery <FileEntity>(_filesTable.Name) select file).Where(w => w.RowKey == poza.Description).AsTableServiceQuery <FileEntity>(_ctx).FirstOrDefault(); poze = new Poza { Description = query.RowKey, ThumbnailUrl = query.ThumbnailUrl, Url = query.Url, Comentarii = GetComentarii(query.RowKey) }; return(poze); }
public void Update(Manager.Model.Poza poza1) { Poza poza = new Poza(); Poza check; if (poza1 != null) { poza.Id = Guid.Parse(poza1.Id); poza.IdProdus = Guid.Parse(poza1.IdProdus); poza.CalePoza = poza1.CalePoza; poza.IsProduct = poza1.IsProduct; check = databaseContext.Poza.FirstOrDefault(existingPoza => existingPoza.Id == Guid.Parse(poza1.Id)); if (check != null) { databaseContext.Poza.Remove(check); databaseContext.Poza.Add(poza); databaseContext.SaveChanges(); } } }
public Infrastructure.ValidationError[] Update(Poza poza) { poza = null; return(pozaManager.Update(poza)); }
public Infrastructure.ValidationError[] Save(Poza poza) { return(pozaManager.Save(poza)); }
public ActionResult GetComentarii(Poza poza) { var service = new AlbumFotoService(); return(View("Comentarii", service.GetComentarii(poza.Description))); }