public bool Run(AomFieldMetaViewModel model, ref IQueryable <AomFieldMeta> repository, IUnitOfWork unitOfWork, Response <AomFieldMetaViewModel> result, ICoreUser user)
        {
            var updatedDbModel  = unitOfWork.With <AomFieldMeta>().Single(c => c.Id == model.Id); // Might be a partial class
            var newCustomResult = AomFieldMetaMapper.MapDbModelToViewModel(updatedDbModel);

            result.Data = newCustomResult;
            return(true);
        }
Beispiel #2
0
        public bool Run(NgTableParams model, ref IQueryable <AomFieldMeta> repository, NgTable <AomFieldMetaViewModel> 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, ref IQueryable <AomFieldMeta> repository, IUnitOfWork unitOfWork, Response <AomFieldMetaViewModel> result, ICoreUser user)
        {
            var dbModel        = repository.Single(c => c.Id == model.Id); // you need to be using the primary key could be composit
            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 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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        public Response <AomFieldMetaViewModel> Run(AomFieldMetaViewModel model, ref IQueryable <AomFieldMeta> repository, IUnitOfWork unitOfWork, Response <AomFieldMetaViewModel> result, ICoreUser user)
        {
            var itemToUpdate = repository.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);
        }