示例#1
0
        public void AddCommentToOrder(OrderCommentBm model, int orderId)
        {
            var orderCommentVm = Mapper.Map <OrderCommentBm, OrderComment>(model);

            orderCommentVm.ApplicationUserId = model.UserId;
            orderCommentVm.OrderId           = orderId;

            this.comments.Add(orderCommentVm);
            this.comments.SaveChanges();
        }
示例#2
0
        public ActionResult AddComment(OrderCommentBm model, int id)
        {
            if (this.ModelState.IsValid)
            {
                this.service.AddCommentToOrder(model, id);
                if (this.User.IsInRole("Admin"))
                {
                    return(this.RedirectToAction("Index", "AdminOrders", new { area = "Admin" }));
                }

                return(this.RedirectToAction("ProfilePage", "Users"));
            }

            return(this.RedirectToAction("ProfilePage", "Users"));
        }