Exemplo n.º 1
0
        //
        // GET: /MediaAudioVideos/CreatePersonMediaAudioVideo
        public ActionResult CreateMediaImageMediaAudioVideo(int mediaImageId, int mediaAudioVideoId)
        {
            var approvalStatusId             = _lookupRepo.GetApprovalStatuses().SingleOrDefault(p => p.Name.Equals("New")).Id;
            var mediaImageMediaAudioVideoRel = new MediaImageMediaAudioVideoRel
            {
                MediaAudioVideoId = mediaAudioVideoId,
                MediaImageId      = mediaImageId,
                ApprovalStatusId  = approvalStatusId,
                DateStart         = DateTime.Now,
            };

            if (mediaAudioVideoId == -1)
            {
                mediaImageMediaAudioVideoRel.MediaAudioVideo = new MediaAudioVideo();
                ViewBag.PossibleRelationshipTypes            = _lookupRepo.GetRelationshipTypes().Where(x => x.ObjectFrom.Equals("Media Image") && x.ObjectTo.Equals("Media Audio/Video")).OrderBy(x => x.SortOrder);
                ViewBag.Controller   = "MediaImages";
                ViewBag.MediaImageId = mediaImageId;
            }
            else
            {
                mediaImageMediaAudioVideoRel.MediaImage = new MediaImage();
                ViewBag.PossibleRelationshipTypes       = _lookupRepo.GetRelationshipTypes().Where(x => x.ObjectFrom.Equals("Media Audio/Video") && x.ObjectTo.Equals("Media Image")).OrderBy(x => x.SortOrder);
                ViewBag.Controller        = "MediaAudioVideos";
                ViewBag.MediaAudioVideoId = mediaAudioVideoId;
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_CreateOrEditMediaImageMediaAudioVideo", mediaImageMediaAudioVideoRel));
            }

            return(View());
        }
Exemplo n.º 2
0
 public ActionResult EditMediaImageMediaAudioVideo(MediaImageMediaAudioVideoRel mediaImagemediaAudioVideorel)
 {
     if (ModelState.IsValid)
     {
         if (mediaImagemediaAudioVideorel.MediaImage == null)
         {
             //reset the mediaImage object.  This is only added from Organization, not MediaImageOrganizationRel.
             mediaImagemediaAudioVideorel.MediaAudioVideo = null;
             _mediaImageRepo.InsertOrUpdateMediaImageMediaAudioVideo(mediaImagemediaAudioVideorel);
             _mediaImageRepo.Save();
             return(RedirectToAction("Details", "MediaImages", new { id = mediaImagemediaAudioVideorel.MediaImageId }));
         }
         //reset the organization object.  This is only added from Organization, not MediaImageOrganizationRel.
         mediaImagemediaAudioVideorel.MediaImage = null;
         _mediaImageRepo.InsertOrUpdateMediaImageMediaAudioVideo(mediaImagemediaAudioVideorel);
         _mediaImageRepo.Save();
         return(RedirectToAction("Details", "MediaAudioVideos", new { id = mediaImagemediaAudioVideorel.MediaAudioVideoId }));
     }
     return(View());
 }
Exemplo n.º 3
0
 public ActionResult CreateMediaImageMediaAudioVideo([Bind(Include = "Id,RelationshipTypeId,DateStart,DateEnd,MediaImageId,MediaAudioVideoId")] MediaImageMediaAudioVideoRel mediaImagemediaAudioVideorel)
 {
     if (ModelState.IsValid)
     {
         if (mediaImagemediaAudioVideorel.MediaImage == null)
         {
             mediaImagemediaAudioVideorel.MediaAudioVideo = null;
             _mediaImageRepo.InsertOrUpdateMediaImageMediaAudioVideo(mediaImagemediaAudioVideorel);
             _mediaImageRepo.Save();
             //return RedirectToAction("Details", "MediaImages", new { id = mediaImagemediaAudioVideorel.MediaImageId });
             return(null);
         }
         else
         {
             //reset the organization object.  This is only added from Organization, not MediaImageOrganizationRel.
             mediaImagemediaAudioVideorel.MediaImage = null;
             _mediaImageRepo.InsertOrUpdateMediaImageMediaAudioVideo(mediaImagemediaAudioVideorel);
             _mediaImageRepo.Save();
             //return RedirectToAction("Details", "MediaAudioVideos", new { id = mediaImagemediaAudioVideorel.MediaAudioVideoId });
             return(null);
         }
     }
     return(View());
 }