Exemplo n.º 1
0
        public ActionResult Edit(ConferenceBase conference, HttpPostedFileBase image)
        {
            conference.Location           = conference.Location.TrimSafeNull();
            conference.MqttBroker         = conference.MqttBroker.TrimSafeNull();
            conference.MqttBrokerPassword = conference.MqttBrokerPassword.TrimSafeNull();
            conference.MqttBrokerUsername = conference.MqttBrokerUsername.TrimSafeNull();
            conference.Name = conference.Name.Trim();
            conference.Url  = conference.Url.TrimSafeNull();
            if (conference.BaseTopicPath != null)
            {
                conference.BaseTopicPath = conference.BaseTopicPath.TrimEnd('#').TrimEnd('/') + "/";
            }
            var previousRecord = _repository.GetConference(PortalSettings.PortalId, conference.ConferenceId);

            if (previousRecord == null)
            {
                conference.PortalId = PortalSettings.PortalId;
                _repository.AddConference(ref conference, User.UserID);
            }
            else
            {
                conference.CreatedOnDate   = previousRecord.CreatedOnDate;
                conference.CreatedByUserID = previousRecord.CreatedByUserID;
                _repository.UpdateConference(conference, User.UserID);
            }
            if (image != null)
            {
                conference.SaveLogo(PortalSettings, image.InputStream, System.IO.Path.GetExtension(image.FileName));
            }
            return(RedirectToDefaultRoute());
        }
 public void DeleteConference(ConferenceBase conference)
 {
     Requires.NotNull(conference);
     Requires.PropertyNotNegative(conference, "ConferenceId");
     using (var context = DataContext.Instance())
     {
         var rep = context.GetRepository <ConferenceBase>();
         rep.Delete(conference);
     }
 }
 public void UpdateConference(ConferenceBase conference, int userId)
 {
     Requires.NotNull(conference);
     Requires.PropertyNotNegative(conference, "ConferenceId");
     conference.LastModifiedByUserID = userId;
     conference.LastModifiedOnDate   = DateTime.Now;
     using (var context = DataContext.Instance())
     {
         var rep = context.GetRepository <ConferenceBase>();
         rep.Update(conference);
     }
 }
 public int AddConference(ref ConferenceBase conference, int userId)
 {
     Requires.NotNull(conference);
     Requires.PropertyNotNegative(conference, "PortalId");
     conference.CreatedByUserID      = userId;
     conference.CreatedOnDate        = DateTime.Now;
     conference.LastModifiedByUserID = userId;
     conference.LastModifiedOnDate   = DateTime.Now;
     using (var context = DataContext.Instance())
     {
         var rep = context.GetRepository <ConferenceBase>();
         rep.Insert(conference);
     }
     return(conference.ConferenceId);
 }
Exemplo n.º 5
0
        public ActionResult Edit(ConferenceBase conference)
        {
            var previousRecord = _repository.GetConference(PortalSettings.PortalId, conference.ConferenceId);

            if (previousRecord == null)
            {
                conference.PortalId = PortalSettings.PortalId;
                _repository.AddConference(ref conference, User.UserID);
            }
            else
            {
                conference.CreatedOnDate   = previousRecord.CreatedOnDate;
                conference.CreatedByUserID = previousRecord.CreatedByUserID;
                _repository.UpdateConference(conference, User.UserID);
            }
            return(RedirectToDefaultRoute());
        }