Example #1
0
 public UserModel SaveUser(UserModel userModel)
 {
     try
     {
         Log.Information("File Name: " + _stackFrame.GetMethod().DeclaringType.Name + ".cs " + "NameSpace: " + _stackFrame.GetMethod().DeclaringType.Namespace + " Method Name: SaveUser() ");
         var     config            = _mapperProfile.MapperUserEntity();
         IMapper iMapper           = config.CreateMapper();
         var     user              = iMapper.Map <UserModel, User>(userModel);
         var     userEntity        = _userRepository.SaveUser(user);
         var     userModelResponse = iMapper.Map <User, UserModel>(userEntity);
         Log.Information("File Name: " + _stackFrame.GetMethod().DeclaringType.Name + ".cs " + "SaveUser() Method Executed Successfully");
         return(userModelResponse);
     }
     catch (Exception ex)
     {
         Log.Error("Error Message: " + ex.Message + " " + ex.StackTrace);
         throw;
     }
 }