예제 #1
0
        public ActionResult ConfirmDemand(string id)
        {
            //string id = Request.QueryString["OrderId"].ToString();
            Guid           demandId      = Guid.Parse(id);
            IDemandManager demandManager = new DemandManager();

            demandManager.Confirm(demandId);
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult RelaseDemand(RelaseDemandViewModel model)
        {
            Guid      userId = Guid.Parse(Session["UserId"].ToString());
            DemandDTO demand = new DemandDTO()
            {
                Content = model.Content, Introduction = model.Introduction, Title = model.Title, UserId = userId, IsHidden = true
            };
            IDemandManager demandManger = new DemandManager();

            demandManger.Release(demand);
            return(RedirectToAction("SucessResult", "Home"));
        }
예제 #3
0
        public ActionResult Myaccount()
        {
            Guid userId = Guid.Parse(Session["UserId"].ToString());
            MyaccountViewModel model          = new MyaccountViewModel();
            IOrderManager      orderManager   = new OrderManager();
            ICommentManager    commentManager = new CommentManager();
            IDemandManager     demandManager  = new DemandManager();

            model.orders   = orderManager.GetAllOrderByUserId(userId);
            model.demands  = demandManager.GetAllDemandByUserId(userId);
            model.comments = commentManager.GetAllCommentByUserId(userId);
            return(View(model));
        }
예제 #4
0
        public void TestMethod4()
        {
            Guid userId = Guid.Parse(/*Session["UserId"].ToString()*/ "d575d2d9-3a22-4465-9fe3-259ab0391988");
            MyaccountViewModel model          = new MyaccountViewModel();
            IOrderManager      orderManager   = new OrderManager();
            ICommentManager    commentManager = new CommentManager();
            IDemandManager     demandManager  = new DemandManager();

            model.orders   = orderManager.GetAllOrderByUserId(userId);
            model.demands  = demandManager.GetAllDemandByUserId(userId);
            model.comments = commentManager.GetAllCommentByUserId(userId);
            Assert.IsNotNull(model.comments);
            Assert.IsNotNull(model.orders);
            Assert.IsNotNull(model.demands);
        }
예제 #5
0
        public void TestMethod2()
        {
            DemandManager dm = new DemandManager();

            dm.Release(new Domain.DTO.DemandDTO()
            {
                Content      = "这是2句话,这是3句话,这是4句话,这是5句话,这是6句话,这是6句话,",
                Title        = "这是一句标题",
                Introduction = "123123",
                UserId       = Guid.Parse("d575d2d9-3a22-4465-9fe3-259ab0391988")
            });
            //foreach (var item in dm.GetAllDemand())
            //{
            //    Assert.AreEqual(Guid.Parse("1e38e6a5-1684-4b2c-95de-196b8bf7690"), item.UserId);
            //}
        }
예제 #6
0
        public ActionResult DemandDetail(Guid?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            IDemandManager    demandManager  = new DemandManager();
            DemandDTO         demand         = demandManager.GetDemand(id.Value);
            ICommentManager   commentManager = new CommentManager();
            List <CommentDTO> comments       = commentManager.GetAllComment(id.Value);
            List <ReplyDTO>   replys         = new List <ReplyDTO>();

            foreach (var item in comments)
            {
                IReplyManager replyManager1 = new ReplyManager();
                replys.Add(replyManager1.GetReply(item.CommentId));
            }
            ViewBag.comment = comments;
            ViewBag.reply   = replys;
            IReplyManager replyManager = new ReplyManager();

            return(View(demand));
        }
예제 #7
0
        public ActionResult Index()
        {
            IDemandManager demandManager = new DemandManager();

            return(View(demandManager.GetAllDemand()));
        }