public static void Add(this DynamicParameters parameters, TestimonialEntity testimonial)
 {
     parameters.Add("testimonialId", testimonial.TestimonialId, DbType.Int32, ParameterDirection.InputOutput, 4);
     parameters.Add("message", testimonial.Message);
     parameters.Add("source", testimonial.Source);
     parameters.Add("sourceDate", testimonial.SourceDate);
 }
Пример #2
0
        public void Save(TestimonialEntity testimonial)
        {
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add(testimonial);
            Execute("dbo.SPSaveTestimonial", parameters);
            testimonial.TestimonialId = parameters.Get <int>("@testimonialId");
        }
Пример #3
0
        /// <summary>
        /// Gets the view models.
        /// </summary>
        /// <param name="entity">The entity object.</param>
        /// <returns>The generated view models.</returns>
        public async Task <IList <ItemViewModel> > GetViewModels(TestimonialEntity entity)
        {
            var response = await this.service.GetItems <TestimonialItem>(entity.Testimonials, new GetAllArgs()
            {
                Fields = new List <string>()
                {
                    "Id", "Photo", "TestimonialAuthor", "Quote", "Company"
                }
            }).ConfigureAwait(true);

            return(response.Items.Select(x => this.GetItemViewModel(x)).ToArray());
        }
Пример #4
0
 public bool UpdateTestimonial(TestimonialEntity testimonialEntity)
 {
     try
     {
         var  testimonial = Mapper.Map <TestimonialEntity, DataAccess.Testimonial>(testimonialEntity);
         bool isEditted   = unitOfWork.VendorTestimonialRepository.Update(testimonial);
         unitOfWork.Save();
         return(isEditted);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #5
0
 public int AddTestimonial(TestimonialEntity testimonialEntity)
 {
     try
     {
         var testimonial          = Mapper.Map <TestimonialEntity, DataAccess.Testimonial>(testimonialEntity);
         var newVendorTestimonial = unitOfWork.VendorTestimonialRepository.Add(testimonial);
         unitOfWork.Save();
         if (newVendorTestimonial != null)
         {
             return(newVendorTestimonial.TestimonialId);
         }
         return(0);
     }
     catch (Exception)
     {
         return(0);
     }
 }
Пример #6
0
 public void Save(TestimonialEntity testimonial)
 {
     _testimonialDataProvider.Save(testimonial);
 }