Exemplo n.º 1
0
        public JsonResult GetWorks()
        {
            var listWork = _iWorkDAL.GetAllWorks().ToList();

            var viewModel = listWork.Select(x => new
            {
                ID          = x.ID,
                WorksTitle  = x.WorksTitle,
                WorksInfo   = x.WorksInfo,
                WorksDetail = x.WorksDetail.Substring(0, x.WorksDetail.Length >= 50 ? 50 : x.WorksDetail.Length),
                WorksDate   = JsonConvert.SerializeObject(x.WorksDate, Formatting.None, new IsoDateTimeConverter()
                {
                    DateTimeFormat = "dd-MM-yyyy"
                }).Trim(new Char[] { '"' }),
            });

            return(Json(viewModel, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public PartialViewResult WorkPartial()
        {
            var model = _iWorkDAL.GetAllWorks().ToList();

            return(PartialView(model));
        }