MVC Action,Service中筛选int 和list<int>

action:

     public ActionResult DeleteByID(int id)
        {
            this.MessageService.DeleteMailTemplate(id);
            var from = Request["from"];
            return RedirectToAction("TemplateIndex", new { from = from });
        }

        public ActionResult DeleteByID(List<int> ids)
        {
            return this.Stop("判断情况是否一致", Request.UrlReferrer.AbsolutePath, true);
        }

 这两个响应会产生报错,


 

而在方法中Service:

 

则是回对两种进行分别的,不会将int看做list<int>型。。(这就跟讲废话一样)

 

不过,action中不进行区分int 和list<int>记住这点就好了。

 

posted @ 2016-01-07 19:26  Danlis  阅读(682)  评论(0编辑  收藏  举报