コード例 #1
0
        public ActionResult Edit(Sermon sermon)
        {
            if (sermon == null)
            {
                throw new ParameterNullException("sermon");
            }

            sermon.ModifiedByUserId = this.ControllerContext.HttpContext.Profile.UserId();
            var success = this.sermonService.UpdateSermon(sermon);

            return this.Json(success, JsonRequestBehavior.AllowGet).AsCamelCaseResolverResult();
        }
コード例 #2
0
        public ActionResult Add(Sermon sermon, HttpPostedFileBase file)
        {
            if (sermon == null)
            {
                throw new ParameterNullException("sermon");
            }

            sermon.ModifiedByUserId = this.ControllerContext.HttpContext.Profile.UserId(); ;
            var sermonId = this.sermonService.AddSermon(sermon);

            return this.Json(sermonId, JsonRequestBehavior.AllowGet).AsCamelCaseResolverResult();
        }
コード例 #3
0
        public static Sermon ToModel(this Data.Entities.Sermon sermonEntity)
        {
            var sermon = new Sermon();

            if (sermonEntity == null)
            {
                return sermon;
            }

            sermon.DateCreated = sermonEntity.DateCreated;
            sermon.DateModified = sermonEntity.DateModified;
            sermon.ModifiedByUserId = sermonEntity.ModifiedByUserId;
            sermon.SermonDate = sermonEntity.SermonDate;
            sermon.SermonId = sermonEntity.SermonId;
            sermon.SoundCloudId = sermonEntity.SoundCloudId;
            sermon.Speaker = sermonEntity.Speaker;
            sermon.Tags = sermonEntity.Tags;
            sermon.Title = sermonEntity.Title;

            return sermon;
        }
コード例 #4
0
 public void Setup()
 {
     this.sermonRepository = new Mock<ISermonRepository>();
     this.sermonService = new SermonService(this.sermonRepository.Object);
     this.sermon = this.OneSermon();
 }