public void CleanUp() { var operations = new ContentOperations <ImageLibraries>(); ImageLibraries library = new ImageLibraries(); library.ID = libraryId; if (operations.GetItem(library).StatusCode == HttpStatusCode.OK) { operations.Delete(library); } }
public ActionResult Edit(ImageLibraries model) { foreach (var image in model.listImage) { if (image.image.IndexOf("data:image/") > -1) { uploadImage(image.image, model.id); } } return(View(model)); }
public void CreateImageLibrary() { var libraryTitle = TestContentPrefix + Guid.NewGuid().ToString(); ImageLibraries library = new ImageLibraries(); library.Title = libraryTitle.ToString(); var operations = new ContentOperations <ImageLibraries>(); var response = operations.CreateDraft(library); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); var results = JsonConvert.DeserializeObject <dynamic>(response.Content); libraryId = results.Id; Assert.IsNotNull(libraryId); }
public ActionResult Edit(int id) { var imgLibs = entity.ImageLibraries.FirstOrDefault(n => n.id == id); var images = entity.Images.Where(n => n.ImageLibraryId == id).Select(item => new Web.Models.Image { image = item.image1 }).ToList(); if (imgLibs == null) { return(Redirect("Index")); } var model = new ImageLibraries(); model.id = imgLibs.id; model.listImage = images; return(View(model)); }
public ActionResult Index(ImageLibraries model) { Debug.WriteLine(model); ImageLibrary img = new ImageLibrary(); img.id = model.id; entity.ImageLibraries.Add(img); if (model.listImage != null) { foreach (var image in model.listImage) { uploadImage(image.image, img.id); } } entity.SaveChanges(); return(View()); }