public bool Run(NgTableParams model, ref IQueryable <AomObject> repository, NgTable <AomObject> result, ICoreUser user, IUnitOfWork db)
    {
        var ngTransformer = new QueryToNgTable <AomObjectViewModel>();

        var query = AomObjectMapper.MapDbModelQueryToViewModelQuery(repository);

        ngTransformer.ToNgTableDataSet(model, query, result);
        return(true);
    }
    public bool Run(AomObjectViewModel model, IUnitOfWork unitOfWork, Response <AomObjectViewModel> result)
    {
        var dbModel        = unitOfWork.With <AomObject>().Find(model.Id);
        var updatedDbModel = AomObjectMapper.MapInsertModelToDbModel(model, dbModel);

        unitOfWork.With <AomObject>().AddOrUpdate(updatedDbModel);
        unitOfWork.SaveChanges();
        var newCustomResult = AomObjectMapper.MapDbModelToViewModel(updatedDbModel);

        result.Data = newCustomResult;
        return(true);
    }
    public bool Run(AomObjectViewModel model, IUnitOfWork unitOfWork, Response <AomObjectViewModel> result)
    {
        var newCustom = AomObjectMapper.MapInsertModelToDbModel(model);

        unitOfWork.With <AomObject>().Add(newCustom);
        unitOfWork.SaveChanges();
        CreatedId = newCustom.Id;
        var newCustomResult = AomObjectMapper.MapDbModelToViewModel(newCustom);

        result.Data = newCustomResult;
        return(true);
    }
    public Response <AomObjectViewModel> Run(AomObjectViewModel model, IUnitOfWork unitOfWork, Response <AomObjectViewModel> result)
    {
        var itemToUpdate = unitOfWork.With <AomObject>().SingleOrDefault(c => c.Id == model.Id);

        if (itemToUpdate != null)
        {
            var newCustomResult = AomObjectMapper.MapDbModelToViewModel(itemToUpdate);
            result.Data    = newCustomResult;
            result.Success = true;
        }
        else
        {
            result.Success = false;
            result.LogError("Error viewing AomObject");
        }

        return(result);
    }