public ActionResult DeleteConfirmed(int id) { GalleryModel galleryModel = db.GalleryModels.Find(id); db.GalleryModels.Remove(galleryModel); db.SaveChanges(); return RedirectToAction("Index"); }
public GalleryModel GetGalleryById(int id) { GalleryModel model = new GalleryModel(); try { using (VenturadaDataContext vdc = new VenturadaDataContext()) { var tableList = from p in vdc.Galleries.ToList() where p.GalleryId == id orderby p.GalleryId ascending select p; model = new GalleryModel(); model.GalleryId = tableList.FirstOrDefault().GalleryId; model.GalleryDescription = tableList.FirstOrDefault().GalleryDescription; model.GalleryTitle = tableList.FirstOrDefault().GalleryTitle; model.ImageString = tableList.FirstOrDefault().ImageString; return(model); } } catch (Exception ex) { throw ex; } }
public ActionResult EditGallery(int galleryId) { CommonDataService cds = new CommonDataService(); CommonModel cm = new CommonModel(); cm = cds.GenerateCommonModel(); Session["FaceBook"] = cm.FaceBook; Session["Twitter"] = cm.Twitter; Session["Youtube"] = cm.Youtube; Session["Instagram"] = cm.Instagram; Session["PhoneNumber"] = cm.PhoneNumber; Session["Email"] = cm.Email; Session["ShoppingHours"] = cm.ShoppingHours; GalleryModel model = new GalleryModel(); GalleryDataService dataService = new GalleryDataService(); try { model = dataService.GetGalleryById(galleryId); return(View(model)); } catch (Exception ex) { throw ex; } finally { dataService = null; } }
public IActionResult Jaegergems(GalleryModel model) { List <string> files = System.IO.Directory.GetFiles("wwwroot/Assets/Jaegergems/").ToList(); string prepend = "https://trilliantring.com/Assets/Jaegergems/"; SortedDictionary <string, string> filenames = new SortedDictionary <string, string> (); files.ForEach(e => filenames.Add(System.IO.Path.GetFileName(e), String.Concat(prepend, System.IO.Path.GetFileName(e)))); List <string> raw_html = new List <string> (); KeyValuePair <string, string>[] elements = filenames.ToArray(); foreach (KeyValuePair <string, string> element in elements) { string add = "<img class=\"photos w-25\" src=\"<element>\" />"; raw_html.Add(add.Replace("<element>", element.Value)); filenames.Remove(element.Key); } model.row_html = String.Join(System.Environment.NewLine, raw_html); return(View("Gallery", model)); }
public IActionResult AddGallery(GalleryModel gallery) { gallery.Img = Utils.GetByteArrayFromImage(gallery.Image); _dbContext.Galleries.Add(gallery); _dbContext.SaveChanges(); return(RedirectToAction("Gallery")); }
private GalleryModel PhotoListToGalleryModel(IEnumerable <Photo> photos) { var galleryModel = new GalleryModel(); var stringBuilder = new StringBuilder(); foreach (var photo in photos) { galleryModel.PhotoModels.Add(new PhotoModel { PhotoId = photo.PhotoId, UserId = photo.UserId, Title = photo.Title, FileName = photo.FileName, Description = photo.Description, SubmittedBy = photo.SubmittedBy, SubmittedOn = photo.CreatedOnDateUtc, Tags = _tagManager.Get(photo.PhotoId) }); stringBuilder.Append(photo.PhotoId + ","); } galleryModel.ListOfPhotoIds = stringBuilder.ToString(); return(galleryModel); }
private void dehighlight(GameObject go) { GalleryModel galleryModel = go.GetComponent <GalleryModel>(); galleryModel.isHighlighted = false; galleryModel.cacheIsHighlighted = false; }
/// <summary> /// 修改图片名称 /// </summary> /// <returns></returns> public ApiResult modifyPhotoName() { try { GalleryModel model = GalleryBLL.Instance.GetModel(this.photoId); if (model != null) { model.Callery_Name = this.photoName; if (GalleryBLL.Instance.Update(model)) { return(new ApiResult(HQEnums.ResultOptionType.OK)); } else { return(new ApiResult(HQEnums.ResultOptionType.失败, "修改图片名称失败")); } } else { return(new ApiResult(HQEnums.ResultOptionType.没有信息, "没有找到该图片")); } } catch (Exception ex) { LogHelper.WriteError(string.Format("modifyPhotoName error-->Statck:{0},Message:{1}", ex.StackTrace, ex.Message)); return(new ApiResult(HQEnums.ResultOptionType.务器错误, "服务器错误")); } }
public ActionResult GetUserCart() { GalleryModel model = new GalleryModel(); try { var userId = model.Users.FirstOrDefault(user => user.Login == User.Identity.Name).Id; var photos = model.UserPhotoes.Where( user => user.UserId == userId) .Select(userPhoto => new PhotoModel { Id = model.Photos.FirstOrDefault(photo => photo.Id == userPhoto.PhotoId).Id, AlbumId = model.Photos.FirstOrDefault(photo => photo.Id == userPhoto.PhotoId).AlbumId, CreationDate = model.Photos.FirstOrDefault(photo => photo.Id == userPhoto.PhotoId).CreationDate.ToString(), descr = model.Photos.FirstOrDefault(photo => photo.Id == userPhoto.PhotoId).Description, name = model.Photos.FirstOrDefault(photo => photo.Id == userPhoto.PhotoId).Title, RateCount = 0, TotalRate = 0, src = model.Photos.FirstOrDefault(photo => photo.Id == userPhoto.PhotoId).Path }).ToArray(); return(Json(photos, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public IActionResult CreateGallery(GalleryModel model, IFormFile GalleryImage) { byte[] gallerybytes; using (var ms = new MemoryStream()) { GalleryImage.CopyTo(ms); gallerybytes = ms.ToArray(); } Gallery gallery = null; gallery = new Gallery { GalleryImage = gallerybytes, AltText = model.AltText, Status = model.Status }; _galleryServices.InsertGallery(gallery); AddNotification(NotificationMessage.TitleSuccess, NotificationMessage.msgAddGallery, NotificationMessage.TypeSuccess); return(RedirectToAction("GalleryList")); }
public IActionResult edit(GalleryModel model, IFormFile file) { try { if (ModelState.IsValid) { GalleryDto galleryDto = new GalleryDto(); galleryDto.gallery_id = model.gallery_id; galleryDto.name = model.name; galleryDto.description = model.description; if (file != null) { galleryDto.name = _fileHelper.saveImageAndGetFileName(file, model.name); } galleryDto.is_active = model.is_active; _galleryService.update(galleryDto); AlertHelper.setMessage(this, "Gallery updated successfully.", messageType.success); return(RedirectToAction("index")); } } catch (Exception ex) { AlertHelper.setMessage(this, ex.Message, messageType.error); } return(View(model)); }
public async Task <IActionResult> AddNewBook(BookModel BM) { if (ModelState.IsValid) { if (BM.CoverPhoto != null) { string folder = "Books/Cover/"; BM.CoverImageUrl = await UploadImage(folder, BM.CoverPhoto); } if (BM.GalleryFiles != null) { string folder = "Books/Gallery"; BM.Gallery = new List <GalleryModel>(); foreach (var file in BM.GalleryFiles) { var gallery = new GalleryModel() { Name = file.FileName, URL = await UploadImage(folder, file) }; BM.Gallery.Add(gallery); } } int id = await _bookrepository.Insert(BM); if (id > 0) { return(RedirectToAction(nameof(AddNewBook), new { isSuccess = true })); } } ViewBag.languages = new SelectList(await _languagerepository.GetLanguage(), "Id", "Name"); return(View()); }
public ActionResult Index() { if (CurrentUser.IsAdministrator) { var galleryModel = new GalleryModel(); IList <Photo> photos = new List <Photo>(_photoManager.Get(1, _config.PhotosPerPage, NotApproved)); foreach (var photo in photos) { galleryModel.PhotoModels.Add(new PhotoModel { PhotoId = photo.PhotoId, UserId = photo.UserId, Description = photo.Description, Title = photo.Title, FileName = photo.FileName, Approved = photo.Approved, SubmittedBy = photo.SubmittedBy, SubmittedOn = photo.CreatedOnDateUtc }); } return(View(galleryModel)); } return(RedirectToAction("Index", "Home")); }
public async Task <IActionResult> AddBooks(BookModel bookModel) { if (ModelState.IsValid) { if (bookModel.CoverPhoto != null) { string folder = "books/cover/"; bookModel.CoverImageUrl = await UploadImage(folder, bookModel.CoverPhoto); } if (bookModel.GalleryImages != null) { string folder = "books/gallery/"; bookModel.Gallery = new List <GalleryModel>(); foreach (var file in bookModel.GalleryImages) { var gallery = new GalleryModel() { Name = file.FileName, Url = await UploadImage(folder, file) }; bookModel.Gallery.Add(gallery); } } if (bookModel.BookPdf != null) { string folder = "books/bookpdf/"; bookModel.BookPdfUrl = await UploadImage(folder, bookModel.BookPdf); } int id = await _bookRepository.AddNewBooks(bookModel); if (id > 0) { return(RedirectToAction(nameof(AddBooks), new { isSuccess = true, bookId = id })); } } ModelState.AddModelError("", "This is Custom message from Controller"); // ViewBag.Language = new SelectList(await _languageRepository.GetAllLagnuage(), "Id", "Name"); // ViewBag.Language = new SelectList(GetLanguage(), "Id", "Text"); //ViewBag.IsSuccess = false; //ViewBag.BookId = 0; return(View()); }
public ActionResult Edit(GalleryModel galleryModel, int id, HttpPostedFileBase file) { GalleryModel galleryModelToDelete = _galleryModelRepository.GetbyId(id); if (galleryModelToDelete == null) { return(HttpNotFound()); } else { if (!ModelState.IsValid) { return(View(galleryModelToDelete)); } else { if (file != null) { galleryModelToDelete.Url = galleryModel.Id + Path.GetFileNameWithoutExtension(file.FileName) + ".jpg"; file.SaveAs(Server.MapPath("//Content//Galleries//") + galleryModelToDelete.Url); } galleryModelToDelete.Title = galleryModel.Title; _galleryModelRepository.Commit(); return(RedirectToAction("Index")); } } }
public ActionResult GetAlbums() { GalleryModel model = new GalleryModel(); List <AlbumModel> models = model.Albums.Select(album => new AlbumModel { Id = album.Id, albumName = album.AlbumName, photos = model.Photos.Where(photo => photo.AlbumId == album.Id).Select(photo => new PhotoModel { Id = photo.Id, AlbumId = photo.AlbumId, CreationDate = photo.CreationDate.ToString(), descr = photo.Description, name = photo.Title, RateCount = photo.RateCount, TotalRate = photo.TotalRate, src = photo.Path }) }).ToList(); var result = Json(models, JsonRequestBehavior.AllowGet); return(result); }
void _galleryModel_MediaRemoved(GalleryModel model, IList <Media> list) { if (ViewModel.IsMediaEditMode) { //TODO: Refresh UI if needed } }
public ApiResponseModel DeleteGallery(GalleryModel galleryModel) { ApiResponseModel apiResponseModel = new ApiResponseModel { Message = "Deleted", MessageType = ApiResponseMessageType.success }; if (galleryModel != null) { var _oldData = _db.MstGallery.Where(x => x.GalleryId.Equals(galleryModel.GalleryId) && x.IsActive == true).FirstOrDefault(); if (_oldData != null) { _oldData.IsActive = false; _oldData.ModifiedDate = DateTime.Now; _oldData.Modifiedby = galleryModel.UserId; _db.Entry(_oldData).State = EntityState.Modified; if (_db.SaveChanges() < 1) { apiResponseModel.Message = "Unable to delete."; apiResponseModel.MessageType = ApiResponseMessageType.error; } } } else { apiResponseModel.Message = "Unable to find record"; apiResponseModel.MessageType = ApiResponseMessageType.warning; } return(apiResponseModel); }
private void lockModel(GameObject go) { GalleryModel galleryModel = go.GetComponent <GalleryModel>(); galleryModel.isUnlocked = false; galleryModel.cacheIsUnlocked = false; }
public HttpResponseMessage GetList() { try { var previews = GalleryModel.List(_galleryRepository).Select(g => new { Id = g.Id, Title = g.Title, ImageCount = g.Images.Count, CreatedDate = g.CreatedDate, UsersName = g.UsersName, Thumbnail = VirtualPathUtility.ToAbsolute("~/Uploads/Images/Galleries/" + g.Uid + "/" + g.Images[0].Thumbnail) }); if (previews == null) { return(Request.CreateResponse(HttpStatusCode.NoContent)); } return(Request.CreateResponse(HttpStatusCode.OK, previews)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
// =========================== // ========== SETUP ========== // =========================== private void refresh(GameObject go) { GalleryModel galleryModel = go.GetComponent <GalleryModel>(); if (galleryModel.isUnlocked) { unlockModel(go); } else { lockModel(go); } if (galleryModel.isHighlighted) { highlight(go); } else { dehighlight(go); } if (galleryModel.isFocused) { focus(go); } else { unfocus(go); } refreshLight(go); }
public List <GalleryModel> GenerateGalleryByRow(int row) { List <GalleryModel> modelList = new List <GalleryModel>(); GalleryModel model = new GalleryModel(); try { using (VenturadaDataContext vdc = new VenturadaDataContext()) { var tableList = from p in vdc.Galleries.ToList() where p.Row == row orderby p.GalleryId ascending select p; foreach (var item in tableList) { model = new GalleryModel(); model.GalleryId = item.GalleryId; model.GalleryDescription = item.GalleryDescription; model.GalleryTitle = item.GalleryTitle; model.Row = item.Row; model.ImageString = item.ImageString; modelList.Add(model); } return(modelList); } } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> postad(AdvertisementModel model) { if (ModelState.IsValid) { model.Userid = _userService.GetUserId(); if (model.GalleryFiles != null) { string folder = "advertisement/gallery/"; model.Gallery = new List <GalleryModel>(); foreach (var file in model.GalleryFiles) { var gallery = new GalleryModel() { Name = file.FileName, URL = await UploadImage(folder, file), }; model.Gallery.Add(gallery); } } var id = await _advertisementRepository.AddNewAdvertisement(model); if (id > 0) { return(RedirectToAction(nameof(managead), new { UserId = 0 })); } } return(View()); }
public GalleryModel GetGalleryModel(long columnId, long entryId) { var model = new GalleryModel(); model.Column = _columnManager.BaseQuery().Include(x => x.Table).GetById(columnId); if (model.Column.ColumnType != ColumnType.MultipleImage) { throw new Exception("Kolon tipi uygun değil."); } model.ColumnId = model.Column.Id; model.EntryId = entryId; model.Name = model.Column.Table.DisplayName + ", " + model.Column.DisplayName; foreach (DataRow row in _sqlProvider .List( $"SELECT * FROM {model.Column.Table.Name}{model.Column.Name}Image WHERE {model.Column.Table.Name}Id={entryId}") .Rows) { model.GalleryImages.Add(new GalleryImage() { Id = Convert.ToInt64(row["Id"]), Image = row["Image"].ToString(), }); } return(model); }
public async Task <IActionResult> AddNewBook(BookModel bookModel) { if (ModelState.IsValid) { // upload image to server if (bookModel.CoverPhoto != null) { string folder = "books/cover/"; bookModel.CoverImageUrl = await UploadFile(folder, bookModel.CoverPhoto); } if (bookModel.GalleryFiles != null) { string folder = "books/gallery/"; bookModel.Gallery = new List <GalleryModel>(); foreach (var file in bookModel.GalleryFiles) { var gallery = new GalleryModel() { Name = file.FileName, URL = await UploadFile(folder, file) }; bookModel.Gallery.Add(gallery); } } if (bookModel.BookPdf != null) { string folder = "books/pdf/"; bookModel.BookPdfUrl = await UploadFile(folder, bookModel.BookPdf); } int id = await _bookRepository.AddNewBook(bookModel); if (id > 0) { return(RedirectToAction(nameof(AddNewBook), new { isSuccess = true, bookId = id })); } } //var group1 = new SelectListGroup() { Name = "Group 1" }; //var group2 = new SelectListGroup() { Name = "Group 2", Disabled = true }; //var group3 = new SelectListGroup() { Name = "Group 3" }; //ViewBag.Language = new List<SelectListItem>() //{ // new SelectListItem() { Text = "Hindi", Value = "1" }, // new SelectListItem() { Text = "English", Value = "2" }, // new SelectListItem() { Text = "Dutch", Value = "3" }, // new SelectListItem() { Text = "Tamil", Value = "4" }, // new SelectListItem() { Text = "Urdu", Value = "5" }, // new SelectListItem() { Text = "Chinese", Value = "6" }, //}; //ViewBag.IsSuccess = false; //ViewBag.BookId = 0; //ModelState.AddModelError("", "This is my custom error message"); //ViewBag.Language = // new SelectList(await _languageRepository.GetLanguages(), "Id", "Name"); return(View()); }
public ActionResult Create() { var model = new GalleryModel(); ViewBag.ActionName = "Create"; ViewBag.Title = "Создание галереи"; return(View("Create", model)); }
void _galleryModel_CellClicked(GalleryModel model, GalleryCellModel cell) { if (ViewModel.IsMediaEditMode) { model.ClearSelection(); cell.IsSelected = true; } }
public BasicCellDetailsPageModel() { vissionMissionModel = new VissionMission(); MsgCmtModel = new MessageModel(); ImageResModel = new GalleryModel(); GalleryModels = new List <IndividualImage>(); CategoryModels = new List <CategoryClass>(); }
public ActionResult Gallery(int id) { GalleryModel galleryModel = new GalleryModel { fileDetails = GetFileList(0), fileModel = GetFileList(id) }; return(View("Gallery", galleryModel)); }
public async Task <DepartmentPageModel> getDepartmentPageDetail(int deptCode) { var http = HttpClientFactory.Create(); DepartmentPageModel departmentPageModel = new DepartmentPageModel(); //Department Details HttpResponseMessage httpResponseMessage = await http.GetAsync(DepartmentRoutes.GetDepartmentByCode + "?code=" + deptCode); var content = httpResponseMessage.Content; string mycontent = await content.ReadAsStringAsync(); DepartmentModel items = JsonConvert.DeserializeObject <DepartmentModel>(mycontent); departmentPageModel.DepartmentModel = items; //Message Of HOD HttpResponseMessage httpResponsePeople = await http.GetAsync(CommonRoutes.GetMessageOFCommitte + "?PageId=" + items._id); var messageContent = httpResponsePeople.Content; string myPeopleContent = await messageContent.ReadAsStringAsync(); MessageModel item = JsonConvert.DeserializeObject <MessageModel>(myPeopleContent); departmentPageModel.MsgCmtModel = item; //Vission Mission HttpResponseMessage httpResponseVM = await http.GetAsync(CommonRoutes.GetVissionMission + "?PageId=" + items._id); var VMContent = httpResponseVM.Content; string myVMContent = await VMContent.ReadAsStringAsync(); VissionMission item2 = JsonConvert.DeserializeObject <VissionMission>(myVMContent); departmentPageModel.VissionMissionModel = item2; //Faculty Details HttpResponseMessage httpResponseFD = await http.GetAsync(CommonRoutes.GetFacultyDetails + "?deptCode=" + items._id); var FDContent = httpResponseFD.Content; string myFDContent = await FDContent.ReadAsStringAsync(); List <FacultyDetailsModel> item3 = JsonConvert.DeserializeObject <List <FacultyDetailsModel> >(myFDContent); departmentPageModel.FacultyDetailsModel = item3; //Get Images HttpResponseMessage httpResponseImage = await http.GetAsync(GalleryRoutes.GetImageByPageIdResponse + "?PageId=" + items._id); var contentImages = httpResponseImage.Content; string myImageContent = await contentImages.ReadAsStringAsync(); GalleryModel itemsRes = JsonConvert.DeserializeObject <GalleryModel>(myImageContent); departmentPageModel.ImageResModel = itemsRes; departmentPageModel.CategoryModels = itemsRes.categoryClass; departmentPageModel.GalleryModels = itemsRes.data; return(departmentPageModel); }
public List<GalleryModel> GetGalleries() { var Igalleries = _gm.GetGalleries(); var newGalleries = new List<GalleryModel>(); foreach (var gal in Igalleries) { var newGallery = new GalleryModel(gal); newGalleries.Add(newGallery); } return newGalleries; }