public ActionResult List() { ContactUsService service = new ContactUsService(); List <ContactUsVM> list = service.SelectList(); return(View(list)); }
public Service(ApplicationDbContext context) { //repository BillingAddressRepository = new Repository <BillingAddress>(context); CategoryRepository = new Repository <Category>(context); ImageRepository = new Repository <Image>(context); ReviewRepository = new Repository <Review>(context); ManufacturerRepository = new Repository <Manufacturer>(context); OrderRepository = new Repository <Order>(context); OrderCountRepository = new Repository <OrderCount>(context); OrderItemRepository = new Repository <OrderItem>(context); ProductRepository = new Repository <Product>(context); ProductCategoryMapping = new Repository <ProductCategoryMapping>(context); ProductImageMapping = new Repository <ProductImageMapping>(context); ProductManufacturerMapping = new Repository <ProductManufacturerMapping>(context); ContactUsMessageRepository = new Repository <ContactUsMessage>(context); VisitorCountRepository = new Repository <VisitorCount>(context); //service CategoryService = new CategoryService(context, CategoryRepository, ProductCategoryMapping); ProductService = new ProductService(context, ProductRepository); ImageManagerService = new ImageManagerService(ImageRepository, ProductImageMapping); ManufacturerService = new ManufacturerService(context, ManufacturerRepository, ProductManufacturerMapping); ReviewService = new ReviewService(context, ReviewRepository); SpecificationService = new SpecificationService(context, SpecificationRepository, ProductSpecificationMapping); ContactUsService = new ContactUsService(ContactUsMessageRepository); OrderService = new OrderService(OrderRepository, OrderItemRepository, OrderCountService, context); OrderCountService = new OrderCountService(OrderCountRepository); VisitorCountService = new VisitorCountService(VisitorCountRepository, context); }
public HttpResponseMessage DeleteContactUs(int id) { SuccessResponse response = new SuccessResponse(); ContactUsService.DeleteContactUs(id); return(Request.CreateResponse(response)); }
public HttpResponseMessage GetContactUs(int id) { ItemResponse <ContactUs> response = new ItemResponse <ContactUs>(); response.Item = ContactUsService.GetContactUs(id); return(Request.CreateResponse(response)); }
public ActionResult Edit(int id) { ContactUsService service = new ContactUsService(); ContactUsVM selectVM = service.selectById(id); return(View(selectVM)); }
public JsonResult SaveSponsorerInfo(SponsorerInfoEntity sponsorInfo) { dynamic jsonData = default(dynamic); try { sponsorInfo.AddedBy = Convert.ToInt32(Session["UserID"]); int SponsorID = new ContactUsService().SaveSponsorInfo(sponsorInfo); if (SponsorID > 0) { jsonData = new { IsSuccess = true }; } else { jsonData = new { IsSuccess = false }; } } catch (Exception) { jsonData = new { IsSuccess = false }; } return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
// POST api/<controller> public IHttpActionResult Post([FromBody] ContactUs value) { ContactUsService cus = new ContactUsService(new SendGridMailAdapter()); cus.Send(value); return(Ok(value)); }
public IHttpActionResult DeleteContactUs1([FromBody] ContactUs value) { ContactUs contactus = new ContactUs(); var contactusservice = new ContactUsService(); contactusservice.DeleteContactUs(value.Id); return(Ok(contactus)); }
public IHttpActionResult DeleteContactUs(int Id) { ContactUs contactus = new ContactUs(); var contactusservice = new ContactUsService(); contactusservice.DeleteContactUs(Id); return(Ok(contactus)); }
public IHttpActionResult AddContactUsMessage([FromBody] ContactUsMessage value) { ContactUsMessage contactusmessage = new ContactUsMessage(); var contactusservice = new ContactUsService(); contactusservice.AddContactUsMessage(value); return(Ok(contactusmessage)); }
public IHttpActionResult AddContactUs([FromBody] ContactUs value) { ContactUs contactus = new ContactUs(); var contactusservice = new ContactUsService(); contactusservice.AddContactUs(value); return(Ok(contactus)); }
public HttpResponseMessage GetListOfContactUs() { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemsResponse <ContactUs> response = new ItemsResponse <ContactUs>(); response.Items = ContactUsService.GetListOfContactUs(); return(Request.CreateResponse(response)); }
public HttpResponseMessage UpdateContactUs(UpdateContactUsRequest model) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } SuccessResponse response = new SuccessResponse(); ContactUsService.UpdateContactUs(model); return(Request.CreateResponse(response)); }
public HttpResponseMessage AddContactUs(AddContactUsRequest model) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <int> response = new ItemResponse <int>(); response.Item = ContactUsService.UpdateContactUs(model); return(Request.CreateResponse(response)); }
public async void AddAsync_InvalidData_ThrowsInvalidDataException(string email, string name, string message) { var mapper = new Mock <IMapper>(); var repository = new Mock <IContactUsRepository>(); ContactUsService contactUsService = new ContactUsService(mapper.Object, repository.Object); ContactUsModel contactUsModel = new ContactUsModel() { Email = email, Name = name, Message = message }; await Assert.ThrowsAsync <InvalidDataException>(async() => { await contactUsService.AddAsync(contactUsModel); }); }
public JsonResult Delete(ContactUsVM inputVM) { ContactUsService service = new ContactUsService(); int result = service.Delete(inputVM); if (result > 0) { return(Json("success")); } else { return(Json("fail")); } }
public JsonResult Entry(ContactUsVM input) { ContactUsService service = new ContactUsService(); int result = service.Save(input); if (result > 0) { return(Json("success")); } else { return(Json("fail")); } }
public async Task TestContactForm() { var contactUsList = new List <ContactForm>(); var mockContactUsRepo = new Mock <IRepository <ContactForm> >(); mockContactUsRepo.Setup(x => x.All()).Returns(contactUsList.AsQueryable()); mockContactUsRepo.Setup(x => x.AddAsync(It.IsAny <ContactForm>())).Callback( (ContactForm contactUs) => contactUsList.Add(contactUs)); var service = new ContactUsService(mockContactUsRepo.Object); await service.CreateAsync("Dimitar Neykov", "*****@*****.**", "Test", "Test Content in contact form!"); Assert.Single(contactUsList); }
public IEnumerable <ContactUs> Get() { List <ContactUs> contactus = new List <ContactUs>(); try { var contactusservice = new ContactUsService(); contactus = (List <ContactUs>)contactusservice.GetContactUs(); } catch { } return(contactus); }
public async void AddAsync_CheckRepositoryCalled_ReturnTrue(string email, string name, string message) { var mapperConfiguration = new MapperConfiguration(cfg => { cfg.AddProfile(new ContactUsProfile()); }); var mapper = mapperConfiguration.CreateMapper(); var repository = new Mock <IContactUsRepository>(); ContactUsModel contactUsModel = new ContactUsModel() { Email = email, Name = name, Message = message }; ContactUsService contactUsService = new ContactUsService(mapper, repository.Object); await contactUsService.AddAsync(contactUsModel); repository.Verify(x => x.AddAsync(It.IsAny <ContactUs>()), Times.Once); }
public HttpResponseMessage GetContactUs1() { List <ContactUs> contactus = new List <ContactUs>(); try { var contactusservice = new ContactUsService(); contactus = (List <ContactUs>)contactusservice.GetContactUs(); } catch { } return(Request.CreateResponse(HttpStatusCode.OK, contactus)); //return ToJson(aboutus); //JavaScriptSerializer json = new JavaScriptSerializer(); //string output = json.Serialize(aboutus); //return output; }
public async Task CanGetFeedbackFromDb() { await this.InstallUmbraco(); await Host.Run(new[] { "create-contact-us-table" }); var model = new ContactUsModel { Name = "Test", Email = "*****@*****.**", Message = "From test" }; var service = new ContactUsService( ApplicationContext.Current.DatabaseContext.Database, ApplicationContext.Current.DatabaseContext.SqlSyntax ); var id = await service.AddFeedbackAsync(model.Name, model.Email, model.Message); var result = await service.GetFeedbackAsync(); Assert.Single(result); Assert.Equal(id, result.First().Id); }
public ContactUsController(ContactUsService contactUsService) { _contactUsService = contactUsService; }