public DataTable List(CommentForType commentForType)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[1];
                switch (commentForType)
                {
                case CommentForType.اخبار:
                {
                    param[0] = new SqlParameter("@commentForType", commentForType);
                    return(SQLHelper.GetDataTable(CommandType.StoredProcedure, "app.spGetCommentsForAdmin", param));
                }

                case CommentForType.رویدادها:
                {
                    param[0] = new SqlParameter("@commentForType", commentForType);
                    return(SQLHelper.GetDataTable(CommandType.StoredProcedure, "app.spGetCommentsForAdmin", param));
                }

                case CommentForType.محصولات:
                {
                    param[0] = new SqlParameter("@commentForType", commentForType);
                    return(SQLHelper.GetDataTable(CommandType.StoredProcedure, "app.spGetCommentsForAdmin", param));
                }

                case CommentForType.مقالات:
                {
                    param[0] = new SqlParameter("@commentForType", commentForType);
                    return(SQLHelper.GetDataTable(CommandType.StoredProcedure, "app.spGetCommentsForAdmin", param));
                }
                }
                return(null);
            }
            catch (Exception e) { throw; }
        }
 public IHttpActionResult List(CommentForType commentForType)
 {
     try
     {
         var result = _service.List(commentForType);
         return(Ok(result));
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
Ejemplo n.º 3
0
        public Result <List <CommentForProductAdminListVM> > List(CommentForType commentForType)
        {
            var model = ConvertDataTableToList.BindList <CommentForProductAdminListVM>(_dataSource.List(commentForType));

            if (model.Count > 0 || model.Count == 0)
            {
                return(Result <List <CommentForProductAdminListVM> > .Successful(data : model));
            }
            else
            {
                return(Result <List <CommentForProductAdminListVM> > .Failure());
            }
        }
Ejemplo n.º 4
0
        public ActionResult Modify(Guid DocumentID, Guid?ParentID, CommentForType CommentForType)
        {
            if (string.IsNullOrEmpty(User.Identity.Name))
            {
                ViewBag.TypeError = 1;
                return(PartialView("~/Views/Comment/_PartialError.cshtml"));
            }
            var result = _service.CanUserComment(DocumentID, SQLHelper.CheckGuidNull(User.Identity.Name));

            if (!result.Success)
            {
                if (ParentID.HasValue)
                {
                    ViewBag.ParentID = ParentID.Value;
                }
                ViewBag.CommentForType = CommentForType;
                return(PartialView("~/Views/Comment/_PartialModify.cshtml"));
            }
            else
            {
                ViewBag.TypeError = 2;
                return(PartialView("~/Views/Comment/_PartialError.cshtml"));
            }
        }