private void CreatePresent() { var presentId = System.Guid.NewGuid().ToString(); var userId = User.Identity.GetUserId(); var list = Request.Form.AllKeys; var photos = DatabaseContextManager.GetPhotosUserNotPresentation(User.Identity.GetUserId()); var present = new PresentationExModel(); present.PresentationId = presentId; present.UserId = userId; int index = 0; foreach (var a in list) { foreach (var b in photos) { if (Request.Form[a].Equals(b.PhotoId)) { if (index == 0) { present.PathBeginPhoto = DatabaseContextManager.GetPathPhoto(b.PhotoId); } b.PresentationId = presentId; b.PositionNumber = index; index++; } } } present.Photos = photos; DatabaseContextManager.AddPresentation(present); }
private void CreateManagerModel(out ManagerModel model, out List <PresentationExModel> presentation) { model = new ManagerModel(); model.UserFloatPhotos = DatabaseContextManager.GetPhotosUserNotPresentation(User.Identity.GetUserId()); presentation = DatabaseContextManager.GetAllPresentation(); model.PathBeginPhoto = new List <string>(); foreach (var a in presentation) { model.PathBeginPhoto.Add(a.PathBeginPhoto); } model.Present = new List <PhotoModel>(); }
public ActionResult UploadEx(String url) { String guid = UploadFileEx(url); var photos = DatabaseContextManager.GetPhotosUserNotPresentation(User.Identity.GetUserId()); foreach (var a in photos) { if (a.PhotoId.Equals(guid)) { return(Json(JsonConvert.SerializeObject(a), JsonRequestBehavior.AllowGet)); } } return(View("Manager")); }