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(); }
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")); }