コード例 #1
0
        public ActionResult NewTestimonial(int?id)
        {
            NewTestimonialViewModel model = new NewTestimonialViewModel()
            {
                BookList          = _bookManagement.GetAll().ToList(),
                ShowingStatusList = EnumHelpers.ConvertEnumToList(typeof(ShowStatus))
            };

            if (id == null)
            {
                model.Testimonial = new Testimonials();
            }
            else
            {
                model.Testimonial = _testimonialsManagement.Get(d => d.ID == id);

                model.ShowingStatus = ConvertHelpers.ConvertBoolToInt(model.Testimonial.IsShow);
            }

            return(View(model));
        }