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