Esempio n. 1
0
        public ActionResult Edit(int id = 0)
        {
            OrganizationViewModel model = new OrganizationViewModel();

            if (id > 0)
            {
                var entity = orgService.GetById(id);
                model = OrganizationMapper.ToViewModel(entity);
            }


            model.IsInRole           = User.IsInRole;
            ViewBag.ListСlassifikate = new SelectList(classifierService.GetAll.ToList(), "Id", "Name");
            return(View(model));
        }
Esempio n. 2
0
        public ActionResult GetOrganization(OrgFilterFiewModel model)
        {
            model.InitSortingData();
            var list = GetOrganizationList(model);
            var res  = list.Select(x => OrganizationMapper.ToViewModel(x));

            var result = res.Select(x => new
            {
                Id               = x.Id,
                Name             = x.Name,
                SmallPathImage   = x.SmallPathImage,
                DateReg          = x.DateCreate.GetFormatDate(),
                ShortDescription = x.ShortDescription,
                Classifier       = x.Classifier.Name,
            });

            return(Json(new { data = result, draw = model.draw, recordsTotal = model.CountTotal, recordsFiltered = model.CountTotal }, JsonRequestBehavior.AllowGet));
        }