public bool Run(AomFieldObjectViewModel model, IUnitOfWork unitOfWork, Response <AomFieldObjectViewModel> result)
    {
        var dbModel        = unitOfWork.With <AomFieldObject>().Find(model.Id);
        var updatedDbModel = AomFieldObjectMapper.MapInsertModelToDbModel(model, dbModel);

        unitOfWork.With <AomFieldObject>().AddOrUpdate(updatedDbModel);
        unitOfWork.SaveChanges();
        var newCustomResult = AomFieldObjectMapper.MapDbModelToViewModel(updatedDbModel);

        result.Data = newCustomResult;
        return(true);
    }
Example #2
0
    public bool Run(AomFieldObjectViewModel model, IUnitOfWork unitOfWork, Response <AomFieldObjectViewModel> result)
    {
        var newCustom = AomFieldObjectMapper.MapInsertModelToDbModel(model);

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

        result.Data = newCustomResult;
        return(true);
    }