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; }
public void Update(SupplierModel model) { var dbModel = _unitOfWork.SupplierRepository.Get(model.Id); dbModel = Mapper.Map(model, dbModel); _unitOfWork.SupplierRepository.Edit(dbModel); }
public ActionResult AjaxEdit(SupplierModel model) { _supplierService.Update(model); return Json(new { success = true }, JsonRequestBehavior.AllowGet); }
public void Create(SupplierModel model) { var dbModel = Mapper.Map<Supplier>(model); _unitOfWork.SupplierRepository.Create(dbModel); }
public ActionResult Get(GridRequestModel gridRequestModel, SupplierModel searchModel, bool _search) { var data = _supplierService.Get(gridRequestModel, _search ? searchModel : null); return Json(data, JsonRequestBehavior.AllowGet); }