Пример #1
0
 public GridResponseModel<SupplierModel> Get(GridRequestModel gridRequestModel, SupplierModel searchModel)
 {
     var query = _unitOfWork.SupplierRepository.Queryable;
     var dbModel = query.ToPagingResult(gridRequestModel);
     var model = dbModel.Rows.Select(m => Mapper.Map<SupplierModel>(m)).ToArray();
     var gridData = new GridResponseModel<SupplierModel>(gridRequestModel, dbModel.RowCount, model);
     return gridData;
 }
Пример #2
0
 public void Update(SupplierModel model)
 {
     var dbModel = _unitOfWork.SupplierRepository.Get(model.Id);
     dbModel = Mapper.Map(model, dbModel);
     _unitOfWork.SupplierRepository.Edit(dbModel);
 }
Пример #3
0
        public ActionResult AjaxEdit(SupplierModel model)
        {
            _supplierService.Update(model);

            return Json(new { success = true }, JsonRequestBehavior.AllowGet);
        }
Пример #4
0
 public void Create(SupplierModel model)
 {
     var dbModel = Mapper.Map<Supplier>(model);
     _unitOfWork.SupplierRepository.Create(dbModel);
 }
Пример #5
0
        public ActionResult Get(GridRequestModel gridRequestModel, SupplierModel searchModel, bool _search)
        {
            var data = _supplierService.Get(gridRequestModel, _search ? searchModel : null);

            return Json(data, JsonRequestBehavior.AllowGet);
        }