Exemplo n.º 1
0
        //partial void RunCustomLogicAfterInsert(ref entCSC.State newDBItem, ref IRepositoryActionResult<entCSC.State> result) {}

        //partial void RunCustomLogicAfterUpdatePatch(ref entCSC.State updatedDBItem, ref IRepositoryActionResult<entCSC.State> result) {}

        partial void RunCustomLogicAfterUpdatePut(ref entCSC.State updatedDBItem, ref IRepositoryActionResult <entCSC.State> result)
        {
            if (result.Status == Enums.RepositoryActionStatus.NotFound)
            {                   // An update/PUT was attempted when it should have been a create/POST.
                var localDBItem  = updatedDBItem;
                var insertResult = RunSync <IRepositoryActionResult <entCSC.State> >(() => Repo.InsertAsync(localDBItem));
                if (insertResult.Status == Enums.RepositoryActionStatus.Created)
                {                   // Insert worked
                    result = new RepositoryActionResult <entCSC.State>(insertResult.Entity, Enums.RepositoryActionStatus.Updated);
                }
            }
        }
 partial void RunCustomLogicOnGetEntityByPK(ref entCSC.State dbItem, Guid stateId, int numChildLevels);
 partial void RunCustomLogicAfterUpdatePut(ref entCSC.State updatedDBItem, ref IRepositoryActionResult <entCSC.State> result);
 partial void RunCustomLogicBeforeUpdatePut(ref entCSC.State updatedDBItem, Guid stateId);
 partial void RunCustomLogicAfterInsert(ref entCSC.State newDBItem, ref IRepositoryActionResult <entCSC.State> result);