Ejemplo n.º 1
0
        partial void RunCustomLogicBeforeUpdatePut(ref entCM.UserProfile updatedDBItem, int userProfileId)
        {
            var existingDBItem = Utils.AsyncHelper.RunSync <entCM.UserProfile>(() => Repo.Get_UserProfileAsync(userProfileId, 1));

            if (existingDBItem != null)
            {
                updatedDBItem.AspNetUsersId   = existingDBItem.AspNetUsersId;               // Do not allow the user to change the "AspNetUsersId" value.
                updatedDBItem.PhotoBlobFileId = existingDBItem.PhotoBlobFileId;             // This must be changed via the UserProfileImagesController.
            }
        }
Ejemplo n.º 2
0
        //partial void RunCustomLogicAfterInsert(ref entCM.UserProfile newDBItem, ref IRepositoryActionResult<entCM.UserProfile> result) {}

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

        partial void RunCustomLogicAfterUpdatePut(ref entCM.UserProfile updatedDBItem, ref IRepositoryActionResult <entCM.UserProfile> 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 = Utils.AsyncHelper.RunSync <IRepositoryActionResult <entCM.UserProfile> >(() => Repo.InsertAsync(localDBItem));
                if (insertResult.Status == Enums.RepositoryActionStatus.Created)
                {                   // Insert worked
                    result = new RepositoryActionResult <entCM.UserProfile>(insertResult.Entity, Enums.RepositoryActionStatus.Updated);
                }
            }
        }
        public async Task <entCM.UserProfile> GetUserProfileAsync(int userProfileId)
        {
            entCM.UserProfile retVal = null;

            try
            {
                var userProfile = await Repo.Get_UserProfileAsync(userProfileId, 1);
            }
            catch (Exception ex)
            {
                Log.Error($"Error in {nameof(GetUserProfileAsync)} {ex.Message}", LogMessageType.Instance.Exception_Domain, ex, userName: userProfileId.ToString());
            }

            return(retVal);
        }
 partial void RunCustomLogicOnGetEntityByPK(ref entCM.UserProfile dbItem, int userProfileId, int numChildLevels);
 partial void RunCustomLogicAfterUpdatePut(ref entCM.UserProfile updatedDBItem, ref IRepositoryActionResult <entCM.UserProfile> result);
 partial void RunCustomLogicBeforeUpdatePut(ref entCM.UserProfile updatedDBItem, int userProfileId);
 partial void RunCustomLogicAfterInsert(ref entCM.UserProfile newDBItem, ref IRepositoryActionResult <entCM.UserProfile> result);