Example #1
0
        // GET: Contact
        public ActionResult Index()
        {
            SupportOnline          supportOnlineDb = _supportService.Get();
            SupportOnlineViewModel supportOnlineVm = Mapper.Map <SupportOnlineViewModel>(supportOnlineDb);

            return(View(supportOnlineVm));
        }
Example #2
0
 public HttpResponseMessage GetAll(HttpRequestMessage request)
 {
     return(CreateHttpResponse(request, () =>
     {
         SupportOnline supportOnlineDb = _supportOnlineService.Get();
         SupportOnlineViewModel supportOnlineVm = Mapper.Map <SupportOnlineViewModel>(supportOnlineDb);
         return request.CreateResponse(HttpStatusCode.OK, supportOnlineVm);
     }));
 }
 public static void UpdateSupportOnline(this SupportOnline support, SupportOnlineViewModel supportVm)
 {
     support.ID       = supportVm.ID;
     support.Name     = supportVm.Name;
     support.Skype    = supportVm.Skype;
     support.Status   = "Kích hoạt";
     support.Facebook = supportVm.Facebook;
     support.Mobile   = supportVm.Mobile;
     support.Email    = supportVm.Email;
 }
Example #4
0
 public HttpResponseMessage Update(HttpRequestMessage request, SupportOnlineViewModel supportOnlineVm)
 {
     return(CreateHttpResponse(request, () =>
     {
         if (ModelState.IsValid)
         {
             SupportOnline supportOnlineDb = _supportOnlineService.Get();
             supportOnlineDb.UpdateSupportOnline(supportOnlineVm);
             _supportOnlineService.Update(supportOnlineDb);
             _supportOnlineService.SaveChange();
             return request.CreateResponse(HttpStatusCode.Created, supportOnlineVm);
         }
         else
         {
             return request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
         }
     }));
 }
Example #5
0
        //[OutputCache(Duration = 3600)]
        public ActionResult Footer()
        {
            FooterCommon footVm = new FooterCommon();
            IEnumerable <ProductCategory> listAll    = _productCategoryService.GetAll();
            IEnumerable <ProductCategory> listParent = listAll.Where(x => x.ParentID == null);
            List <ProductCategory>        listChild  = new List <ProductCategory> {
            };

            foreach (var item in listParent)
            {
                var list = listAll.Where(x => x.ParentID == item.ID);
                if (list.Count() == 0)
                {
                    listChild.Add(item);
                }
                else
                {
                    listChild.AddRange(list);
                }
            }
            listChild = listChild.OrderBy(x => x.Name).Take(9).ToList();
            IEnumerable <ProductCategoryViewModel> listCategoryVm = Mapper.Map <IEnumerable <ProductCategoryViewModel> >(listChild);

            footVm.listCategoryProduct = listCategoryVm;

            IEnumerable <Tag>          listTagProdut = _tagService.GetAll().Where(x => x.Type == Common.CommonConstant.ProductTag.ToString()).OrderBy(x => x.Name).Take(18);
            IEnumerable <TagViewModel> listTagVm     = Mapper.Map <IEnumerable <TagViewModel> >(listTagProdut);

            footVm.tagVm = listTagVm;

            SupportOnline          supportDb = _supportOnline.Get();
            SupportOnlineViewModel supportVm = Mapper.Map <SupportOnlineViewModel>(supportDb);

            footVm.supportOnlineVm = supportVm;

            Footer          footerDb = _footerService.GetAll();
            FooterViewModel footerVm = Mapper.Map <FooterViewModel>(footerDb);

            footVm.footerVm = footerVm;

            return(PartialView(footVm));
        }
Example #6
0
        public void Create(SupportOnlineModel model)
        {
            var data = Connect_Enttity.SupportOnlines.FirstOrDefault(x => x.ID == model.ID);

            if (data == null)
            {
                var entity = new SupportOnline();
                entity.Name         = model.Name;
                entity.Department   = model.Department;
                entity.Skype        = model.Skype;
                entity.Mobile       = model.Mobile;
                entity.Email        = model.Email;
                entity.Yahoo        = model.Yahoo;
                entity.Facebook     = model.Facebook;
                entity.Status       = model.Status;
                entity.DisplayOrder = Convert.ToInt32(model.DisplayOrder);

                Connect_Enttity.SupportOnlines.Add(entity);
                Connect_Enttity.SaveChanges();
                Dispose();
            }
        }
Example #7
0
 public void Update(SupportOnline supportOnline)
 {
     _unitOfWork.Commit();
 }
Example #8
0
 public void Add(SupportOnline supportOnline)
 {
     _supportOnlineRepository.Add(supportOnline);
 }
 public void Update(SupportOnline supportOnline)
 {
     _supportOnlineRepository.Update(supportOnline);
 }
Example #10
0
 public SupportOnline Add(SupportOnline supportOnline)
 {
     return(_supportOnlineRepository.Add(supportOnline));
 }