public ActionResult AddEdit([Bind(Include = "Id,PatientName,PatientDesignation,PatientExperience,IsActive")] TestimonialsModel objTestimonialsModel, HttpPostedFileBase file)
        {
            int retvalue = 0;

            if (objTestimonialsModel.Id == 0) // Add About Clinic to system.
            {
                retvalue = _ITestimonials.AddTestimonial(objTestimonialsModel, file);
            }
            else
            {
                if (file != null)
                {
                    MemoryStream target = new MemoryStream();
                    file.InputStream.CopyTo(target);
                    objTestimonialsModel.PatientImage = target.ToArray();
                }
                else
                {
                    var objOldData = _ITestimonials.GetTestimonial(objTestimonialsModel.Id);
                    //var oldservice = db.Services.Where(m => m.ServiceId == objAboutClinic.Id).FirstOrDefault();
                    objTestimonialsModel.PatientImage = objOldData.PatientImage;
                }
                retvalue = _ITestimonials.UpdateTestimonial(objTestimonialsModel);
            }
            if (retvalue > 0)
            {
                return(RedirectToAction("ShowTestimonials"));
            }
            return(View(objTestimonialsModel));
        }
Exemplo n.º 2
0
        public ActionResult RenderTestimonials()
        {
            IPublishedContent homePage = CurrentPage.AncestorOrSelf("home");
            string            title    = homePage.GetPropertyValue <string>("testimonialsTitle");
            string            intro    = homePage.GetPropertyValue("testimonialsIntroduction").ToString(); // don't want the html

            List <TestimonialModel> testimonials     = new List <TestimonialModel>();
            ArchetypeModel          testimonialsList = homePage.GetPropertyValue <ArchetypeModel>("testimonialList");

            if (testimonialsList != null)
            {
                foreach (ArchetypeFieldsetModel fsm in testimonialsList.Take(3))
                {
                    string name  = fsm.GetValue <string>("name");
                    string quote = fsm.GetValue <string>("quote");
                    testimonials.Add(new TestimonialModel()
                    {
                        Name  = name,
                        Quote = quote
                    });
                }
            }

            TestimonialsModel model = new TestimonialsModel()
            {
                Title        = title,
                Introduction = intro,
                Testimonials = testimonials
            };

            return(PartialView(PARTIAL_VIEW_FOLDER + "_Testimonials.cshtml", model));
        }
Exemplo n.º 3
0
        //public LatestBlogPost GetLatestBlogPostModel()
        //{
        //    IPublishedContent page = CurrentPage.AncestorOrSelf("home");
        //    LatestBlogPost model = new LatestBlogPost()
        //    {
        //        Title = page.GetPropertyValue<string>("latestBlogPostsTitle"),
        //        Introduction = page.GetPropertyValue<string>("latestBlogPostsIntroduction")
        //    };
        //    return model;
        //}

        public ActionResult RenderTestimonials()
        {
            const string      HOME_PAGE_DOC_TYPE_ALIAS = "home";
            IPublishedContent page            = CurrentPage.AncestorOrSelf(HOME_PAGE_DOC_TYPE_ALIAS);
            ArchetypeModel    testimonialList = page.GetPropertyValue <ArchetypeModel>("testimonialList");

            List <TestimonialModel> testimonials = new List <TestimonialModel>();

            if (testimonials != null || testimonials.Count > 0)
            {
                foreach (ArchetypeFieldsetModel fieldSet in testimonialList.Take(MAX_TESTIMONIAL))
                {
                    testimonials.Add(new TestimonialModel()
                    {
                        Name  = fieldSet.GetValue <string>("name"),
                        Quote = fieldSet.GetValue <string>("quote")
                    });
                }
            }


            TestimonialsModel model = new TestimonialsModel()
            {
                Title        = page.GetPropertyValue <string>("testimonialsTitle"),
                Introduction = page.GetPropertyValue <string>("testimonialsIntroduction"),
                Testimonials = testimonials
            };

            return(PartialView(PartialViewPath("_Testimonials"), model));
        }
Exemplo n.º 4
0
        public int AddTestimonial(TestimonialsModel objTestimonial, HttpPostedFileBase file)
        {
            if (file != null)
            {
                MemoryStream target = new MemoryStream();
                file.InputStream.CopyTo(target);
                objTestimonial.PatientImage = target.ToArray();
            }

            objTestimonial.CreatedDate = DateTime.Now.Date;
            objTestimonial.UpdatedDate = DateTime.Now.Date;
            objTestimonial.IsActive    = true;
            using (PhysioDevEntities db = new PhysioDevEntities())
            {
                try
                {
                    Testimonial testimonial = new Testimonial();
                    objTestimonial.CopyProperties(testimonial);
                    db.Testimonials.Add(testimonial);
                    return(db.SaveChanges());
                }
                catch (Exception ex)
                {
                    return(0);

                    throw ex;
                }
            }
        }
Exemplo n.º 5
0
        public ActionResult Create()
        {
            var model = new TestimonialsModel();

            model.IsActive = true;
            return(View(model));
        }
Exemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("List"));
            }

            var testimonials = testimonialsService.GetById(id.Value);

            if (testimonials == null)
            {
                this.NotifyError("Item not found.");
                return(RedirectToAction("List"));
            }

            var model = new TestimonialsModel
            {
                Id              = testimonials.Id,
                ClientName      = testimonials.ClientName,
                WhatSayAboutUs  = testimonials.WhatSayAboutUs,
                PersonName      = testimonials.PersonName,
                PersonPosition  = testimonials.PersonPosition,
                Star            = testimonials.Star,
                IsActive        = testimonials.IsActive,
                Website         = testimonials.Website,
                ClientLogoId    = testimonials.ClientLogoId,
                PersonPictureId = testimonials.PersonPictureId,
                OrderNo         = testimonials.OrderNo,
                TypeName        = testimonials.TypeName
            };

            return(View(model));
        }
Exemplo n.º 7
0
        public ResultModel <bool> CreateTestimonials(TestimonialsModel testimonialsModel)
        {
            ResultModel <bool> result       = new ResultModel <bool>();
            Testimonials       testimonials = new Testimonials(testimonialsModel.Name, testimonialsModel.Description, testimonialsModel.ProjectName, testimonialsModel.URL, testimonialsModel.Designation);

            testimonials.CreatedBy = 1;
            unitOfWork.TestimonialsRepository.Insert(testimonials);
            result.StatusCode = Convert.ToInt32(Enums.StatusCode.OK);
            result.Data       = true;
            result.Success    = true;
            return(result);
        }
Exemplo n.º 8
0
        public TestimonialsModel GetTestimonial(int?Id)
        {
            TestimonialsModel objTestimonialsModel = new TestimonialsModel();

            if (Id != null)
            {
                using (PhysioDevEntities db = new PhysioDevEntities())
                {
                    var Testimonial = db.Testimonials.Where(m => m.Id == Id).FirstOrDefault();
                    Testimonial.CopyProperties(objTestimonialsModel);
                }
            }

            return(objTestimonialsModel);
        }
Exemplo n.º 9
0
        public List <TestimonialsModel> GetAllTestimonial()
        {
            List <TestimonialsModel> lstTestimonialModel = new List <TestimonialsModel>();

            using (PhysioDevEntities db = new PhysioDevEntities())
            {
                var lstTestimonials = db.Testimonials.Where(m => m.IsActive == true).OrderByDescending(m => m.Id).ToList();
                foreach (var testimonial in lstTestimonials)
                {
                    TestimonialsModel objTestimonial = new TestimonialsModel();
                    testimonial.CopyProperties(objTestimonial);
                    lstTestimonialModel.Add(objTestimonial);
                }
            }
            return(lstTestimonialModel);
        }
Exemplo n.º 10
0
        public ActionResult <ResultVM <bool> > Create(TestimonialsVM testimonialsVM)
        {
            ResultVM <bool> resultVM = new ResultVM <bool>();

            try
            {
                TestimonialsModel testimonialsModel = new TestimonialsModel();
                mapper.Map(testimonialsVM, testimonialsModel);
                var result = testimonialsBusiness.CreateTestimonials(testimonialsModel);
                mapper.Map(result, resultVM);
                return(resultVM);
            }
            catch (Exception ex)
            {
                resultVM.Message    = ex.Message;
                resultVM.StatusCode = Convert.ToInt32(Enums.StatusCode.BadRequest);
                return(StatusCode(StatusCodes.Status400BadRequest, new { Result = resultVM }));
            }
        }
Exemplo n.º 11
0
        public ResultModel <bool> UpdateTestimonials(TestimonialsModel testimonialsModel)
        {
            ResultModel <bool> result = new ResultModel <bool>();
            var testimonials          = unitOfWork.TestimonialsRepository.Get(x => x.BsonId == testimonialsModel.BsonId && !x.IsDeleted).FirstOrDefault();

            if (testimonials != null)
            {
                testimonialsModel.UpdatedBy = 1;
                testimonialsModel.UpdatedOn = DateTime.UtcNow;
                testimonialsModel.CreatedBy = testimonials.CreatedBy;
                testimonialsModel.CreatedOn = testimonials.CreatedOn;
                mapper.Map(testimonialsModel, testimonials);
                unitOfWork.TestimonialsRepository.Update(testimonials);
                result.StatusCode = Convert.ToInt32(Enums.StatusCode.OK);
                result.Data       = true;
                result.Success    = true;
            }
            return(result);
        }
Exemplo n.º 12
0
        public ActionResult <ResultVM <bool> > Update(TestimonialsVM testimonialsVM)
        {
            ResultVM <bool> resultVM = new ResultVM <bool>();

            try
            {
                TestimonialsModel TestimonialsModel = new TestimonialsModel();
                mapper.Map(testimonialsVM, TestimonialsModel);
                var result = testimonialsBusiness.UpdateTestimonials(TestimonialsModel);
                mapper.Map(result, resultVM);
            }
            catch (Exception ex)
            {
                Common.LogMessage(ex.Message);
                resultVM.Message    = ex.Message;
                resultVM.StatusCode = Convert.ToInt32(Enums.StatusCode.BadRequest);
                return(StatusCode(StatusCodes.Status400BadRequest, new { Result = resultVM, Codes = new string[] { "ServerError" } }));
            }
            return(resultVM);
        }
Exemplo n.º 13
0
        public ActionResult Edit(TestimonialsModel model)
        {
            if (ModelState.IsValid)
            {
                var testimonials = testimonialsService.GetById(model.Id);
                if (testimonials == null)
                {
                    this.NotifyError("Item not found.");
                    return(RedirectToAction("List"));
                }
                else
                {
                    testimonials.ClientName      = model.ClientName;
                    testimonials.WhatSayAboutUs  = model.WhatSayAboutUs;
                    testimonials.PersonName      = model.PersonName;
                    testimonials.PersonPosition  = model.PersonPosition;
                    testimonials.Star            = model.Star;
                    testimonials.IsActive        = model.IsActive;
                    testimonials.Website         = model.Website;
                    testimonials.PersonPictureId = model.PersonPictureId;
                    testimonials.ClientLogoId    = model.ClientLogoId;
                    testimonials.UpdateDateUtc   = DateTime.UtcNow;
                    testimonials.OrderNo         = model.OrderNo;
                    testimonials.TypeName        = model.TypeName;

                    var result = testimonialsService.Update(testimonials);
                    if (result)
                    {
                        this.NotifySuccess("Successfully saved.");
                    }
                    else
                    {
                        this.NotifyError("Item can not saved!");
                    }
                }

                return(RedirectToAction("Edit", new { id = model.Id }));
            }

            return(View(model));
        }
Exemplo n.º 14
0
        public int UpdateTestimonial(TestimonialsModel objTestimonial)
        {
            using (PhysioDevEntities db = new PhysioDevEntities())
            {
                objTestimonial.UpdatedDate = DateTime.Now.Date;

                try
                {
                    Testimonial testimonial = new Testimonial();
                    objTestimonial.CopyProperties(testimonial);
                    db.Entry(testimonial).State = EntityState.Modified;
                    return(db.SaveChanges());
                }
                catch (Exception ex)
                {
                    return(0);

                    throw ex;
                }
            }
        }
Exemplo n.º 15
0
 public int InsertTestimonial(TestimonialsModel testimonial)
 {
     try
     {
         using (var query = new SqlQuery())
         {
             var result = query.ExecuteNonQuery("InsertUpdateTestimonials", new Dictionary <string, object>
             {
                 { "ClientName", testimonial.ClientName },
                 { "Logo", testimonial.Logo },
                 { "Description", testimonial.Description },
                 { "IsActive", testimonial.IsActive }
             });
             return(result);
         }
     }
     catch (Exception ex)
     {
         //Logger.LogError("Admin:Login", ex.Message);
         string msg = ex.ToString();
         throw;
     }
 }
Exemplo n.º 16
0
        public ActionResult Create(TestimonialsModel model)
        {
            if (ModelState.IsValid)
            {
                var testimonials = new Core.Entities.ClientTestimonials
                {
                    Id              = model.Id,
                    ClientName      = model.ClientName,
                    WhatSayAboutUs  = model.WhatSayAboutUs,
                    PersonName      = model.PersonName,
                    PersonPosition  = model.PersonPosition,
                    Star            = model.Star,
                    Website         = model.Website,
                    IsActive        = model.IsActive,
                    OrderNo         = model.OrderNo,
                    CreateDateUtc   = DateTime.UtcNow,
                    TypeName        = model.TypeName,
                    ClientLogoId    = model.ClientLogoId,
                    PersonPictureId = model.PersonPictureId
                };

                var result = testimonialsService.Insert(testimonials);
                if (result)
                {
                    this.NotifySuccess("Successfully saved.");
                }
                else
                {
                    this.NotifyError("Item can not saved!");
                }

                return(RedirectToAction("Edit", new { Id = testimonials.Id }));
            }

            return(View(model));
        }