public bool Run(NgTableParams model, ref IQueryable <AomFieldMeta> repository, NgTable <AomFieldMeta> result, ICoreUser user, IUnitOfWork db) { var ngTransformer = new QueryToNgTable <AomFieldMetaViewModel>(); var query = AomFieldMetaMapper.MapDbModelQueryToViewModelQuery(repository); ngTransformer.ToNgTableDataSet(model, query, result); return(true); }
public bool Run(AomFieldMetaViewModel model, IUnitOfWork unitOfWork, Response <AomFieldMetaViewModel> result) { var dbModel = unitOfWork.With <AomFieldMeta>().Find(model.Id); var updatedDbModel = AomFieldMetaMapper.MapInsertModelToDbModel(model, dbModel); unitOfWork.With <AomFieldMeta>().AddOrUpdate(updatedDbModel); unitOfWork.SaveChanges(); var newCustomResult = AomFieldMetaMapper.MapDbModelToViewModel(updatedDbModel); result.Data = newCustomResult; return(true); }
public bool Run(AomFieldMetaViewModel model, IUnitOfWork unitOfWork, Response <AomFieldMetaViewModel> result) { var newCustom = AomFieldMetaMapper.MapInsertModelToDbModel(model); unitOfWork.With <AomFieldMeta>().Add(newCustom); unitOfWork.SaveChanges(); CreatedId = newCustom.Id; var newCustomResult = AomFieldMetaMapper.MapDbModelToViewModel(newCustom); result.Data = newCustomResult; return(true); }
public Response <AomFieldMetaViewModel> Run(AomFieldMetaViewModel model, IUnitOfWork unitOfWork, Response <AomFieldMetaViewModel> result) { var itemToUpdate = unitOfWork.With <AomFieldMeta>().SingleOrDefault(c => c.Id == model.Id); if (itemToUpdate != null) { var newCustomResult = AomFieldMetaMapper.MapDbModelToViewModel(itemToUpdate); result.Data = newCustomResult; result.Success = true; } else { result.Success = false; result.LogError("Error viewing AomFieldMeta"); } return(result); }